Submission #426374

# Submission time Handle Problem Language Result Execution time Memory
426374 2021-06-13T21:04:47 Z duality The Collection Game (BOI21_swaps) C++14
100 / 100
7 ms 456 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
#include "swaps.h"

void solve(int N,int V) {
    int i,j,k,l;
    vi order;
    for (i = 1; i <= N; i++) order.pb(i);
    for (i = 1; i <= N; i *= 2) {
        for (j = i; j >= 1; j /= 2) {
            vpii v;
            for (k = j % i; k < N-j; k += 2*j) {
                for (l = 0; l < j; l++) {
                    if (j+k+l >= N) break;
                    if ((k+l)/(2*i) == (j+k+l)/(2*i)) v.pb(mp(k+l,j+k+l));
                }
            }
            for (k = 0; k < v.size(); k++) schedule(order[v[k].first],order[v[k].second]);
            vi r = visit();
            for (k = 0; k < v.size(); k++) {
                if (!r[k]) swap(order[v[k].first],order[v[k].second]);
            }
        }
    }
    answer(order);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:24:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             for (k = 0; k < v.size(); k++) schedule(order[v[k].first],order[v[k].second]);
      |                         ~~^~~~~~~~~~
swaps.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             for (k = 0; k < v.size(); k++) {
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 1 ms 200 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 5 ms 372 KB Correct
5 Correct 5 ms 300 KB Correct
6 Correct 5 ms 304 KB Correct
7 Correct 5 ms 304 KB Correct
8 Correct 6 ms 308 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 1 ms 292 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 6 ms 312 KB Correct
5 Correct 5 ms 300 KB Correct
6 Correct 5 ms 300 KB Correct
7 Correct 5 ms 300 KB Correct
8 Correct 5 ms 308 KB Correct
9 Correct 5 ms 304 KB Correct
10 Correct 5 ms 308 KB Correct
11 Correct 6 ms 304 KB Correct
12 Correct 5 ms 304 KB Correct
13 Correct 5 ms 308 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 1 ms 200 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 1 ms 200 KB Correct
3 Correct 1 ms 200 KB Correct
4 Correct 2 ms 200 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 1 ms 200 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 6 ms 300 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 1 ms 200 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 6 ms 300 KB Correct
5 Correct 1 ms 200 KB Correct
6 Correct 2 ms 200 KB Correct
7 Correct 3 ms 292 KB Correct
8 Correct 6 ms 308 KB Correct
9 Correct 5 ms 308 KB Correct
10 Correct 6 ms 304 KB Correct
11 Correct 6 ms 308 KB Correct
12 Correct 5 ms 300 KB Correct
13 Correct 1 ms 200 KB Correct
14 Correct 1 ms 200 KB Correct
15 Correct 4 ms 200 KB Correct
16 Correct 6 ms 304 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 6 ms 304 KB Correct
5 Correct 5 ms 284 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 6 ms 304 KB Correct
5 Correct 5 ms 284 KB Correct
6 Correct 1 ms 200 KB Correct
7 Correct 2 ms 256 KB Correct
8 Correct 3 ms 200 KB Correct
9 Correct 6 ms 304 KB Correct
10 Correct 5 ms 304 KB Correct
11 Correct 5 ms 308 KB Correct
12 Correct 5 ms 304 KB Correct
13 Correct 7 ms 304 KB Correct
14 Correct 5 ms 308 KB Correct
15 Correct 5 ms 304 KB Correct
16 Correct 5 ms 308 KB Correct
17 Correct 5 ms 300 KB Correct
18 Correct 6 ms 300 KB Correct
19 Correct 1 ms 200 KB Correct
20 Correct 1 ms 456 KB Correct
21 Correct 3 ms 200 KB Correct
22 Correct 5 ms 308 KB Correct
23 Correct 5 ms 304 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 320 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 5 ms 296 KB Correct
5 Correct 5 ms 276 KB Correct
6 Correct 5 ms 264 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 320 KB Correct
3 Correct 2 ms 200 KB Correct
4 Correct 5 ms 296 KB Correct
5 Correct 5 ms 276 KB Correct
6 Correct 5 ms 264 KB Correct
7 Correct 1 ms 200 KB Correct
8 Correct 1 ms 200 KB Correct
9 Correct 3 ms 200 KB Correct
10 Correct 5 ms 304 KB Correct
11 Correct 5 ms 304 KB Correct
12 Correct 5 ms 424 KB Correct
13 Correct 5 ms 304 KB Correct
14 Correct 5 ms 304 KB Correct
15 Correct 5 ms 308 KB Correct
16 Correct 6 ms 312 KB Correct
17 Correct 5 ms 304 KB Correct
18 Correct 5 ms 304 KB Correct
19 Correct 6 ms 304 KB Correct
20 Correct 1 ms 200 KB Correct
21 Correct 2 ms 200 KB Correct
22 Correct 3 ms 200 KB Correct
23 Correct 5 ms 304 KB Correct
24 Correct 5 ms 268 KB Correct
25 Correct 5 ms 280 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 5 ms 392 KB Correct
5 Correct 6 ms 284 KB Correct
6 Correct 5 ms 264 KB Correct
7 Correct 5 ms 264 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 5 ms 392 KB Correct
5 Correct 6 ms 284 KB Correct
6 Correct 5 ms 264 KB Correct
7 Correct 5 ms 264 KB Correct
8 Correct 1 ms 200 KB Correct
9 Correct 1 ms 200 KB Correct
10 Correct 2 ms 284 KB Correct
11 Correct 3 ms 200 KB Correct
12 Correct 5 ms 308 KB Correct
13 Correct 6 ms 304 KB Correct
14 Correct 4 ms 376 KB Correct
15 Correct 5 ms 308 KB Correct
16 Correct 4 ms 308 KB Correct
17 Correct 5 ms 304 KB Correct
18 Correct 5 ms 300 KB Correct
19 Correct 5 ms 304 KB Correct
20 Correct 5 ms 300 KB Correct
21 Correct 6 ms 320 KB Correct
22 Correct 1 ms 200 KB Correct
23 Correct 1 ms 292 KB Correct
24 Correct 3 ms 296 KB Correct
25 Correct 5 ms 304 KB Correct
26 Correct 7 ms 264 KB Correct
27 Correct 5 ms 280 KB Correct
28 Correct 5 ms 284 KB Correct