Submission #1002554

#TimeUsernameProblemLanguageResultExecution timeMemory
1002554AndreyThe Collection Game (BOI21_swaps)C++14
50 / 100
302 ms1632 KiB
#include "swaps.h"
#include<bits/stdc++.h>
using namespace std;

void solve(int n, int v) {
    vector<int> haha(n);
    for(int i = 0; i < n; i++) {
        haha[i] = i+1;
    }
    for(int i = 0; i < v; i++) {
        vector<pair<int,int>> wut(0);
        for(int j = i%2; j+1 < n; j+=2) {
            wut.push_back({j,j+1});
            schedule(haha[j],haha[j+1]);
        }
        vector<int> wow = visit();
        for(int j = 0; j < wow.size(); j++) {
            if(wow[j] == 0) {
                swap(haha[wut[j].first],haha[wut[j].second]);
            }
        }
    }
    answer(haha);
}

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int j = 0; j < wow.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...