Submission #409173

# Submission time Handle Problem Language Result Execution time Memory
409173 2021-05-20T09:58:18 Z jamezzz MalnaRISC (COI21_malnarisc) C++14
0 / 100
5 ms 588 KB
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define sf scanf
#define pf printf
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;

queue<ii> q1,q2;
int use[105];
vector<ii> ans[10005];

int main(){
	int n;sf("%d",&n);
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n;++j){
			q1.push(ii(i,j));
		}
	}
	int cnt=0;
	while(!q1.empty()){
		++cnt;
		memset(use,false,sizeof use);
		while(!q1.empty()){
			ii pr=q1.front();q1.pop();
			if(use[pr.fi]||use[pr.se]){
				q2.push(pr);
				continue;
			}
			use[pr.fi]=use[pr.se]=true;
			ans[cnt].push_back(pr);
		}
		while(!q2.empty()){
			q1.push(q2.front());
			q2.pop();
		}
	}
	pf("%d\n",cnt);
	for(int i=1;i<=cnt;++i){
		for(ii pr:ans[i])pf("CMPSWP %d %d ",pr.fi,pr.se);
		pf("\n");
	}
}

Compilation message

malnarisc.cpp: In function 'int main()':
malnarisc.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  int n;sf("%d",&n);
      |          ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 460 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 588 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 588 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 588 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 588 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 588 KB Token "1" doesn't correspond to pattern "R[0-9]{1,3}"