Submission #867018

# Submission time Handle Problem Language Result Execution time Memory
867018 2023-10-27T15:12:29 Z HossamHero7 The Collection Game (BOI21_swaps) C++14
27 / 100
47 ms 2580 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+1};
    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-1].first ++;
            else cnt[a-1].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 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 10 ms 796 KB Correct
4 Correct 36 ms 1816 KB Correct
5 Correct 36 ms 2304 KB Correct
6 Correct 35 ms 2056 KB Correct
7 Correct 35 ms 1832 KB Correct
8 Correct 37 ms 2060 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 600 KB Correct
3 Correct 10 ms 800 KB Correct
4 Correct 36 ms 2324 KB Correct
5 Correct 36 ms 2580 KB Correct
6 Correct 36 ms 1824 KB Correct
7 Correct 40 ms 1884 KB Correct
8 Correct 36 ms 2572 KB Correct
9 Correct 36 ms 2076 KB Correct
10 Correct 42 ms 2072 KB Correct
11 Correct 36 ms 2052 KB Correct
12 Correct 40 ms 1812 KB Correct
13 Correct 47 ms 2312 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 3 ms 600 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 3 ms 600 KB Correct
3 Incorrect 0 ms 344 KB Not correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 600 KB Correct
3 Correct 11 ms 792 KB Correct
4 Correct 36 ms 1800 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 600 KB Correct
3 Correct 11 ms 792 KB Correct
4 Correct 36 ms 1800 KB Correct
5 Correct 0 ms 344 KB Correct
6 Correct 2 ms 344 KB Correct
7 Correct 10 ms 792 KB Correct
8 Correct 41 ms 1812 KB Correct
9 Correct 38 ms 2056 KB Correct
10 Correct 39 ms 1816 KB Correct
11 Correct 37 ms 2308 KB Correct
12 Correct 37 ms 2308 KB Correct
13 Incorrect 0 ms 344 KB Not correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 11 ms 804 KB Correct
4 Correct 34 ms 1820 KB Correct
5 Runtime error 22 ms 1808 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 11 ms 804 KB Correct
4 Correct 34 ms 1820 KB Correct
5 Runtime error 22 ms 1808 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 10 ms 792 KB Correct
4 Correct 35 ms 1816 KB Correct
5 Runtime error 21 ms 2564 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 10 ms 792 KB Correct
4 Correct 35 ms 1816 KB Correct
5 Runtime error 21 ms 2564 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 340 KB Correct
3 Correct 10 ms 796 KB Correct
4 Correct 35 ms 1808 KB Correct
5 Runtime error 21 ms 1804 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 340 KB Correct
3 Correct 10 ms 796 KB Correct
4 Correct 35 ms 1808 KB Correct
5 Runtime error 21 ms 1804 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -