#include<bits/stdc++.h>
using namespace std;
#define N 110
#define INFLL 2000000000000000020
#define pb push_back
typedef long long ll;
typedef pair<ll,ll> pll;
bool mat[N][N];
bool blocked[N];
vector<pll>query[N*N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,ops,q=0,i,j,sz;
cin >> n;
ops=n*(n-1);
for(i=1;i<=n;i++)
{
mat[i][i]=true;
}
while(ops)
{
for(i=1;i<=n;i++)
blocked[i]=false;
for(i=1;i<=n;i++)
{
if(blocked[i])
continue;
for(j=1;j<=n;j++)
{
if(blocked[j] || mat[i][j])
continue;
blocked[i]=true;
blocked[j]=true;
mat[i][j]=true;
mat[j][i]=true;
ops-=2;
query[q].pb({i,j});
break;
}
}
q++;
}
cout << q << endl;
for(i=0;i<q;i++)
{
sz=(ll)(query[i].size());
for(j=0;j<sz;j++)
{
cout << "CMPSWP R" << query[i][j].first <<
" R" << query[i][j].second << ((j==sz-1) ? '\n' : ' ');
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
604 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
604 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
604 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
600 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
604 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
600 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
856 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
856 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
856 KB |
Partially correct |