#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define bug(x) cout << #x << " " << x << endl;
#define pii pair<int, int>
const int inf = 1e9 + 10;
const int maxn = 100;
queue<pii> fila[maxn];
vector<int> marc( maxn );
int main(){
int n; cin >> n;
for( int i = 1; i < n; i++ ){
for( int j = 1; j <= n - i; j++ ){
fila[i].push({j, j + 1});
}
}
bool ok = true;
while( ok ) {
for( int i = 1; i <= n ;i++ ) marc[i] = 0;
ok = false ;
for( int i = 1; i < n; i++ ){
if( !fila[i].empty() && !marc[fila[i].front().first] && !marc[fila[i].front().second] ){
marc[fila[i].front().first] = 1;
marc[fila[i].front().second] = 1;
cout << "CMPSWP R" << fila[i].front().first << " R" << fila[i].front().second << " ";
fila[i].pop();
if( !fila[i].empty() ) ok = true;
}
}
cout << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Expected integer, but "CMPSWP" found |
2 |
Halted |
0 ms |
0 KB |
- |