Submission #1002905

#TimeUsernameProblemLanguageResultExecution timeMemory
1002905gabistroehMalnaRISC (COI21_malnarisc)C++14
67.63 / 100
3 ms5468 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...