Submission #1045826

# Submission time Handle Problem Language Result Execution time Memory
1045826 2024-08-06T07:58:23 Z hirayuu_oj The Collection Game (BOI21_swaps) C++17
25 / 100
52 ms 852 KB
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rng(i,l,r) for(int i=(l); i<(r); i++)
#define all(x) x.begin(),x.end()
using ll=long long;
#include "swaps.h"

void solve(int N, int V) {
    // TODO implement this function
    vector<int> find(N);
    iota(all(find),1);
    vector<int> ans;
    rep(i,N) {
        vector<int> now=find;
        while(now.size()>1) {
            vector<int> nxt;
            if(now.size()%2==1) {
                nxt={now.back()};
            }
            rep(j,now.size()/2) {
                schedule(now[j*2],now[j*2+1]);
            }
            vector<int> go=visit();
            rep(j,now.size()/2) {
                nxt.emplace_back(now[j*2+go[j]]);
            }
            now=nxt;
        }
        ans.emplace_back(now[0]);
        rep(i,find.size()) {
            if(find[i]==now[0]) {
                swap(find[i],find.back());
                find.pop_back();
                break;
            }
        }
    }
    reverse(all(ans));
    answer(ans);
}
/*
4 1000
1 2 3 4
0
1
0
1
1
0
0
1
1
1
0
0

*/

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:3:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                                ^
swaps.cpp:21:13: note: in expansion of macro 'rep'
   21 |             rep(j,now.size()/2) {
      |             ^~~
swaps.cpp:3:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                                ^
swaps.cpp:25:13: note: in expansion of macro 'rep'
   25 |             rep(j,now.size()/2) {
      |             ^~~
swaps.cpp:3:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                                ^
swaps.cpp:31:9: note: in expansion of macro 'rep'
   31 |         rep(i,find.size()) {
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 15 ms 852 KB Correct
4 Correct 39 ms 452 KB Correct
5 Correct 39 ms 592 KB Correct
6 Correct 46 ms 688 KB Correct
7 Correct 50 ms 692 KB Correct
8 Correct 36 ms 704 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 5 ms 344 KB Correct
3 Correct 18 ms 600 KB Correct
4 Correct 41 ms 440 KB Correct
5 Correct 41 ms 468 KB Correct
6 Correct 36 ms 456 KB Correct
7 Correct 47 ms 684 KB Correct
8 Correct 45 ms 692 KB Correct
9 Runtime error 12 ms 704 KB Execution killed with signal 11
10 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
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 0 ms 344 KB Correct
4 Correct 4 ms 436 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 5 ms 600 KB Correct
3 Correct 17 ms 344 KB Correct
4 Correct 52 ms 688 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 5 ms 600 KB Correct
3 Correct 17 ms 344 KB Correct
4 Correct 52 ms 688 KB Correct
5 Correct 1 ms 344 KB Correct
6 Correct 3 ms 344 KB Correct
7 Correct 23 ms 448 KB Correct
8 Correct 47 ms 472 KB Correct
9 Correct 48 ms 704 KB Correct
10 Correct 47 ms 480 KB Correct
11 Correct 33 ms 448 KB Correct
12 Correct 47 ms 684 KB Correct
13 Correct 1 ms 344 KB Correct
14 Correct 3 ms 440 KB Correct
15 Correct 13 ms 452 KB Correct
16 Correct 44 ms 700 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 5 ms 344 KB Correct
3 Correct 17 ms 464 KB Correct
4 Correct 46 ms 684 KB Correct
5 Runtime error 11 ms 696 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 5 ms 344 KB Correct
3 Correct 17 ms 464 KB Correct
4 Correct 46 ms 684 KB Correct
5 Runtime error 11 ms 696 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 14 ms 600 KB Correct
4 Correct 39 ms 456 KB Correct
5 Runtime error 10 ms 596 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 14 ms 600 KB Correct
4 Correct 39 ms 456 KB Correct
5 Runtime error 10 ms 596 KB Execution killed with signal 11
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 16 ms 696 KB Correct
4 Correct 35 ms 452 KB Correct
5 Runtime error 9 ms 492 KB Execution killed with signal 11
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 16 ms 696 KB Correct
4 Correct 35 ms 452 KB Correct
5 Runtime error 9 ms 492 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -