# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
414537 | 2021-05-30T15:32:00 Z | medmdg | MalnaRISC (COI21_malnarisc) | C++14 | 3 ms | 408 KB |
#include <bits/stdc++.h> #define ll long long #define endl "\n" using namespace std; void pr(pair<ll,ll> a){ cout<<"CMPSWP R"<<a.first<<" R"<<a.second<<" "; } int main() { vector<pair<ll,ll> > B; ll n; cin>>n; vector<vector<pair<ll,ll> > >ans; bool a[n][n]={{false}}; for(int i=0;i<n;i++) a[i][i]=true; for(int f=0;f<n;f++){ bool h[n]={false}; if(f>0) if(ans[ans.size()-1].size()==0) break; ans.push_back(B); for(int i=0;i<n;i++){ if(h[i]) continue; for(int j=0;j<n;j++){ if(h[j]) continue; if(a[i][j]==false){ a[i][j]=true; h[i]=true; h[j]=true; a[j][i]=true; ans[f].push_back(make_pair(i+1,j+1)); break; } } } } cout<<ans.size()<<endl; for(int i=0;i<ans.size();i++){ for(int j=0;j<ans[i].size();j++){ pr(ans[i][j]); } cout<<endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 296 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Unexpected end of file - token expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 284 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 408 KB | not sorted |