# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404785 | tqbfjotld | MalnaRISC (COI21_malnarisc) | C++14 | 2 ms | 332 KiB |
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;
vector<vector<pair<int,int> > > stuff(int n){
if (n==2){
vector<pair<int,int> > t;
t.push_back({1,2});
vector<vector<pair<int,int> > >ret;
ret.push_back(t);
return ret;
}
vector<vector<pair<int,int> > > ret;
auto res = stuff(n/2);
for (auto x : res){
vector<pair<int,int> > t;
for (auto y : x){
t.push_back({y.first,y.second});
t.push_back({n/2+y.first,n/2+y.second});
}
ret.push_back(t);
}
vector<pair<int,int> > t3;
for (int x = 0; x<n/2; x++){
t3.push_back({x+1,n-x});
}
ret.push_back(t3);
int t2 = n/4;
while (t2>0){
vector<pair<int,int> > t;
for (int x = 0; x<n; x++){
if ((x&t2)==0){
t.push_back({x+1,x+t2+1});
}
}
ret.push_back(t);
t2>>=1;
}
return ret;
}
int main(){
int n;
scanf("%d",&n);
int t = 1;
while (t<n) t<<=1;
auto res = stuff(t);
printf("%d\n",res.size());
for (auto x : res){
for (auto y : x){
if (y.first>n || y.second>n) continue;
printf("CMPSWP R%d R%d ",y.first,y.second);
}
printf("\n");
}
}
Compilation message (stderr)
# | 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... |