Submission #1002905

# Submission time Handle Problem Language Result Execution time Memory
1002905 2024-06-19T21:17:36 Z gabistroeh MalnaRISC (COI21_malnarisc) C++14
67.6284 / 100
3 ms 5468 KB
#include<bits/stdc++.h>
using namespace std;

int mark[2010][2010];
vector <pair<int, int> > comandos[200010];
int N;

bool check(){
	for(int i=1; i<=N; i++){
		for(int j=i+1; j<=N; j++){
			if(mark[i][j]==0) return 0;
		}
	}
	return 1;
}

int main(){
	cin >> N;
	int resp = 0;
	while(!check()){
		resp++;
		int usado[N+1];
		for(int i=1; i<=N; i++) usado[i] = 0;
		for(int i=1; i<=N; i++){
			for(int j=i+1; j<=N; j++){
				if(usado[i]==1) break;
				if(mark[i][j]==0 && usado[j]==0){
					mark[i][j] = 1;
					comandos[resp].push_back({i, j});
					usado[i] = 1;
					usado[j] = 1;
				}
			}
		}
	}

	cout << resp << endl;
	for(int i=1; i<=resp; i++){
		for(int j=0; j<comandos[i].size(); j++){
			cout << "CMPSWP R" << comandos[i][j].first << " R" << comandos[i][j].second << " ";
		}
		cout << endl;
	}
}

Compilation message

malnarisc.cpp: In function 'int main()':
malnarisc.cpp:39:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |   for(int j=0; j<comandos[i].size(); j++){
      |                ~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 4956 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 4952 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 5212 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 5208 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 5212 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 5464 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 5468 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 5468 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 5464 KB Partially correct