Submission #41903
ソースコード
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 | #include <bits/stdc++.h> using namespace std; #define FOR(i,n) for(int i=0;i<n;i++) #define why(n,x) int n;while(cin >>n,n!=x) #define iFOR(i,x,n)for(int i=x;i<n;i++) int dx[]={1,0,-1,0}; int dy[]={0,-1,0,1}; int dxx[]={1,1,0,-1,-1,-1,0,1}; int dyy[]={0,-1,-1,-1,0,1,1,1}; bool inside( int x, int y, int w, int h){ return (x>=0 && y>=0 && x<w && y<h);} typedef long long ll; typedef pair< int , int > pii; int main(){ cin.tie(0), ios::sync_with_stdio( false ); int n,m,a[200]; cin >>n>>m; FOR(i,n) cin >>a[i]; for ( int i=1;i<=m;i++){ for ( int j=0;j<n-1;j++){ if (a[j]%i>a[j+1]%i){ int temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } FOR(i,n) cout <<a[i]<<endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0258 - ゼッケンの交換 (Swapping Bibs) |
ユーザー名 | ei1821 |
投稿日時 | 2018-08-26 09:03:22 |
言語 | C++11 |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 761 Byte |
最大実行時間 | 39 ms |
最大メモリ使用量 | 648 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 | 39 ms | 480 KB |
1
|
||||
2016-yo-t2-in2.txt | AC | 22 ms | 436 KB |
2
|
||||
2016-yo-t2-in3.txt | AC | 24 ms | 388 KB |
3
|
||||
2016-yo-t2-in4.txt | AC | 22 ms | 476 KB |
4
|
||||
2016-yo-t2-in5.txt | AC | 24 ms | 560 KB |
5
|
||||
2016-yo-t2-in_s1.txt | AC | 21 ms | 648 KB | |||||
2016-yo-t2-in_s2.txt | AC | 23 ms | 608 KB |