Submission #987267

# Submission time Handle Problem Language Result Execution time Memory
987267 2024-05-22T13:29:39 Z MateiKing80 The Collection Game (BOI21_swaps) C++14
35 / 100
1028 ms 6716 KB
#include "swaps.h"
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define fr first
#define sc second
#define pii pair<int, int>

void solve(int n, int v)
{
    set<pii> inf;
    for(int i = 1; i <= n; i ++)
        for(int j = i + 1; j <= n; j ++)
            inf.insert({i,j});

    vector<int> ans(n);
    for(int i = 0; i < n; i ++)
        ans[i] = i + 1;

    for(int i = 0; i < v; i ++)
    {
        set<int> vis;
        set<pii> er;
        vector<pii> ins;
        for(auto it : inf)
        {
            int x = it.fr, y = it.sc;
            if(!vis.count(x) && !vis.count(y))
            {
                schedule(ans[x-1], ans[y-1]);
                vis.insert(x);
                vis.insert(y);
                ins.pb({x,y});
                er.insert(it);
            }
        }

        for(auto it : er) 
            inf.erase(it);

        vector<int> get = visit();
        for(int j = 0; j < get.size(); j ++)
        {
            int x = ins[j].fr, y = ins[j].sc;
            bool val = get[j];
            if(!val)
                swap(ans[x-1], ans[y-1]);
        }
    }
    answer(ans);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:44:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for(int j = 0; j < get.size(); j ++)
      |                        ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 22 ms 596 KB Correct
2 Correct 30 ms 600 KB Correct
3 Correct 165 ms 1880 KB Correct
4 Correct 934 ms 6316 KB Correct
5 Correct 925 ms 6332 KB Correct
6 Correct 963 ms 6332 KB Correct
7 Correct 919 ms 6336 KB Correct
8 Correct 963 ms 6332 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 166 ms 1880 KB Correct
4 Correct 956 ms 6716 KB Correct
5 Correct 966 ms 6312 KB Correct
6 Correct 958 ms 6324 KB Correct
7 Correct 912 ms 6584 KB Correct
8 Correct 967 ms 6332 KB Correct
9 Correct 931 ms 6308 KB Correct
10 Correct 946 ms 6568 KB Correct
11 Correct 1028 ms 6312 KB Correct
12 Correct 1027 ms 6308 KB Correct
13 Correct 920 ms 6332 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 18 ms 344 KB Correct
4 Correct 33 ms 600 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 344 KB Correct
2 Correct 37 ms 760 KB Correct
3 Correct 150 ms 1880 KB Correct
4 Correct 921 ms 6332 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 344 KB Correct
2 Correct 37 ms 760 KB Correct
3 Correct 150 ms 1880 KB Correct
4 Correct 921 ms 6332 KB Correct
5 Correct 17 ms 352 KB Correct
6 Correct 30 ms 600 KB Correct
7 Correct 144 ms 1880 KB Correct
8 Correct 888 ms 6332 KB Correct
9 Correct 905 ms 6332 KB Correct
10 Correct 895 ms 6568 KB Correct
11 Correct 885 ms 6568 KB Correct
12 Correct 877 ms 6564 KB Correct
13 Correct 22 ms 344 KB Correct
14 Correct 33 ms 596 KB Correct
15 Correct 146 ms 1880 KB Correct
16 Correct 881 ms 6312 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
3 Correct 153 ms 1880 KB Correct
4 Correct 906 ms 6336 KB Correct
5 Incorrect 864 ms 6304 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
3 Correct 153 ms 1880 KB Correct
4 Correct 906 ms 6336 KB Correct
5 Incorrect 864 ms 6304 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
3 Correct 146 ms 1880 KB Correct
4 Correct 893 ms 6308 KB Correct
5 Incorrect 879 ms 6316 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
3 Correct 146 ms 1880 KB Correct
4 Correct 893 ms 6308 KB Correct
5 Incorrect 879 ms 6316 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 28 ms 600 KB Correct
3 Correct 146 ms 1880 KB Correct
4 Correct 873 ms 6328 KB Correct
5 Incorrect 872 ms 6312 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 28 ms 600 KB Correct
3 Correct 146 ms 1880 KB Correct
4 Correct 873 ms 6328 KB Correct
5 Incorrect 872 ms 6312 KB Not correct
6 Halted 0 ms 0 KB -