#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
void print(int a, int b){
cout << "CMPSWP ";
cout << "R" << a << " ";
cout << "R" << b << " ";
}
int main(){
int n; cin >> n;
set<pii> pares;
for(int d=1; d<=n; d++){
for(int i=1; i+d<=n; i++){
pares.insert({i,i+d});
}
}
int cnt=0;
vector<vector<pii>> arr;
while(pares.size()){
vector<bool> mark(n+1);
arr.pb({});
for(auto[a,b] : pares){
if(!mark[a] && !mark[b]){
mark[a]=mark[b]=true;
arr.back().pb({a,b});
}
}
for(auto ab : arr.back()) pares.erase(ab);
cnt++;
}
cout << cnt << '\n';
for(auto v : arr){
for(auto[a,b] : v) print(a,b);
cout << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
348 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
348 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
600 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
3 ms |
600 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
3 ms |
600 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
4 ms |
600 KB |
Partially correct |