Submission #55812
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include <set> #include <map> #include <list> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <cstdio> #include <vector> #include <string> #include <bitset> #include <cctype> #include <cstdlib> #include <cstring> #include <utility> #include <numeric> #include <complex> #include <sstream> #include <fstream> #include <iomanip> #include <cassert> #include <iostream> #include <iterator> #include <algorithm> using namespace std; typedef long long ll; typedef vector< int > vint; typedef pair< int , int > pint; typedef vector< long long > vlong; #define vpush(a,x) a.push_back(x); #define rep(i, n) REP(i, 0, n) #define all(v) v.begin(), v.end() #define REP(i, x, n) for(int i = x; i < n; i++) #define INF 2e9 signed main(){ cin.tie(0); ios::sync_with_stdio( false ); int n,m,h; vint a(n); cin>>n>>m; rep(i,n){ cin>>a[i]; } REP(i,1,m+1){ rep(j,n-1){ if (a[j]%i > a[j+1]%i){ h=a[j+1]; a[j+1]=a[j]; a[j]=h; } } } rep(i,n){ cout<<a[i]<< '\n' ; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0258 - ゼッケンの交換 (Swapping Bibs) |
ユーザー名 | ei1918 |
投稿日時 | 2019-10-29 16:22:56 |
言語 | C++ |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 1090 Byte |
最大実行時間 | 36 ms |
最大メモリ使用量 | 16988 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | INPUT1 | 1 / 1 | *in1.txt |
2 | INPUT2 | 1 / 1 | *in2.txt |
3 | INPUT3 | 1 / 1 | *in3.txt |
4 | INPUT4 | 1 / 1 | *in4.txt |
5 | INPUT5 | 1 / 1 | *in5.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2016-yo-t2-in1.txt | AC | 35 ms | 16988 KB |
1
|
||||
2016-yo-t2-in2.txt | AC | 27 ms | 16804 KB |
2
|
||||
2016-yo-t2-in3.txt | AC | 19 ms | 16880 KB |
3
|
||||
2016-yo-t2-in4.txt | AC | 36 ms | 16948 KB |
4
|
||||
2016-yo-t2-in5.txt | AC | 30 ms | 16896 KB |
5
|
||||
2016-yo-t2-in_s1.txt | AC | 19 ms | 16964 KB | |||||
2016-yo-t2-in_s2.txt | AC | 23 ms | 16904 KB |