Submission #867010

# Submission time Handle Problem Language Result Execution time Memory
867010 2023-10-27T15:08:00 Z HossamHero7 The Collection Game (BOI21_swaps) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "swaps.h"
//#include "grader.cpp"
void solve(int n, int v) {
    vector<vector<pair<int,int>>> ans(n*2);
    vector<pair<int,int>> cnt(n);
    for(int i=0;i<n;i++) cnt[i] = {0,i};
    int idx = 0;
    for(int i=1;i<=n;i++){
        int idxx = idx;
        for(int j=i+1;j<=n;j++){
            ans[idxx].push_back({i,j});
            idxx ++;
        }
        idx += 2;
    }
    for(int i=0;i<n*2;i++){
        if(ans[i].empty()) break;
        for(auto [a,b] : ans[i]) schedule(a,b);
        vector<int> ret = visit();
        for(int j=0;j<ans[i].size();j++){
            auto [a,b] = ans[i][j];
            if(ret[j]) cnt[b].first ++;
            else cnt[a].first ++;
        }
    }
    sort(cnt.begin(),cnt.end());
    vector<int> anss;
    for(auto [_,i] : cnt) anss.push_back(i);
    answer(anss);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:21:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |         for(auto [a,b] : ans[i]) schedule(a,b);
      |                  ^
swaps.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for(int j=0;j<ans[i].size();j++){
      |                     ~^~~~~~~~~~~~~~
swaps.cpp:24:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   24 |             auto [a,b] = ans[i][j];
      |                  ^
swaps.cpp:31:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   31 |     for(auto [_,i] : cnt) anss.push_back(i);
      |              ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -