This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define sc second
#define sz(v) (int)v.size()
typedef pair<int,int> pii;
vector< pair<pii,pii>> v;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n; cin>>n;
for(int i = 1; i <= n; i++){
int r = n-i, x = i+1;
if(r%2 == 0){
if(x > n)continue;
//cout<<i<<" "<<x<<" caso1\n";
v.push_back({ {i,x}, {-1,-1} });
x++;
if(x == n){
//cout<<i<<" "<<x<<" caso2\n";
v.push_back({ {i,x}, {-1,-1} });
continue;
}
if(x > n)continue;
//cout<<i<<" "<<x<<" caso3\n";
v.push_back({ {i,x}, {x+1,x+2} });
x++;
}else{
if(x == n){
//cout<<i<<" "<<x<<" caso5\n";
v.push_back({ {i,x}, {-1,-1} });
continue;
}
if(x > n)continue;
//cout<<i<<" "<<x<<" caso4\n";
v.push_back({ {i,x}, {x+1,x+2} });
x++;
}
for(int j = x; j <= n; j+=2){
if(j+2 > n)v.push_back({ {i,j}, {-1,-1} });
else v.push_back({ {i,j}, {j+2,j+3} });
}
}
cout<<sz(v)<<"\n";
for(int i = 0; i < sz(v); i++){
cout<<"CMPSWP R"<<v[i].fi.fi<<" R"<<v[i].fi.sc;
if(v[i].sc.fi != -1)cout<<" CMPSWP R"<<v[i].sc.fi<<" R"<<v[i].sc.sc;
cout<<"\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |