Submission #409174

# Submission time Handle Problem Language Result Execution time Memory
409174 2021-05-20T09:58:47 Z jamezzz MalnaRISC (COI21_malnarisc) C++14
67.6284 / 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 R%d R%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 Correct 1 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 460 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 460 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 460 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 460 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 588 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 588 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 588 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 588 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 588 KB Partially correct