Submission #740340

# Submission time Handle Problem Language Result Execution time Memory
740340 2023-05-12T10:59:57 Z nicky4321 The Collection Game (BOI21_swaps) C++14
50 / 100
67 ms 428 KB
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
#include "swaps.h"
#define ll long long
#define ld long double
#define F first
#define S second
#define PB push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define vi vector<int>
#define vl vector<ll>
#define CASE int t;cin>>t;for(int ca=1;ca<=t;ca++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
const int MAX = 1 << 20, MOD = 1e9 + 7;
int a[MAX];

void solve(int N, int V) {
	vi v;
	ll n = N;
	if(n == 1){
		answer({1});
		return;
	}
	for(int i = 1;i <= n;i++) {
		a[i] = i;
	}
	int cl = 1;
	for(int c = 0;c < n;c++){
		int l = cl;
        vector<pii> vp;
		while(l + 1 <= n){
			schedule(a[l], a[l + 1]);
            vp.PB({l, l + 1});
			l += 2;
		}
		vi vv = visit();
        for(int i = 0;i < SZ(vp);i++)
            if(vv[i] == 0)
                swap(a[vp[i].F], a[vp[i].S]);
		if(cl == 2){
			cl = 1;
		}
		else{
			cl = 2;
		}
	}
    for(int i = 1;i <= n;i++)
        v.PB(a[i]);
	answer(v);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:44:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   44 |             if(vv[i] == 0)
      |             ^~
swaps.cpp:46:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   46 |   if(cl == 2){
      |   ^~
swaps.cpp:53:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   53 |     for(int i = 1;i <= n;i++)
      |     ^~~
swaps.cpp:55:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   55 |  answer(v);
      |  ^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 18 ms 208 KB Correct
4 Correct 57 ms 356 KB Correct
5 Correct 48 ms 312 KB Correct
6 Correct 50 ms 312 KB Correct
7 Correct 62 ms 348 KB Correct
8 Correct 48 ms 312 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
3 Correct 15 ms 256 KB Correct
4 Correct 45 ms 316 KB Correct
5 Correct 46 ms 308 KB Correct
6 Correct 64 ms 312 KB Correct
7 Correct 48 ms 368 KB Correct
8 Correct 51 ms 400 KB Correct
9 Correct 52 ms 316 KB Correct
10 Correct 45 ms 308 KB Correct
11 Correct 67 ms 312 KB Correct
12 Correct 56 ms 312 KB Correct
13 Correct 54 ms 312 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
3 Correct 0 ms 208 KB Correct
4 Correct 4 ms 260 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 236 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 18 ms 208 KB Correct
4 Correct 57 ms 376 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 236 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 18 ms 208 KB Correct
4 Correct 57 ms 376 KB Correct
5 Correct 0 ms 208 KB Correct
6 Correct 3 ms 208 KB Correct
7 Correct 20 ms 208 KB Correct
8 Correct 51 ms 316 KB Correct
9 Correct 66 ms 312 KB Correct
10 Correct 38 ms 312 KB Correct
11 Correct 62 ms 308 KB Correct
12 Correct 63 ms 312 KB Correct
13 Correct 0 ms 208 KB Correct
14 Correct 4 ms 300 KB Correct
15 Correct 15 ms 208 KB Correct
16 Correct 60 ms 304 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 18 ms 208 KB Correct
4 Correct 46 ms 312 KB Correct
5 Correct 45 ms 288 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 18 ms 208 KB Correct
4 Correct 46 ms 312 KB Correct
5 Correct 45 ms 288 KB Correct
6 Correct 1 ms 264 KB Correct
7 Correct 4 ms 280 KB Correct
8 Correct 14 ms 208 KB Correct
9 Correct 48 ms 312 KB Correct
10 Correct 64 ms 316 KB Correct
11 Correct 60 ms 308 KB Correct
12 Correct 50 ms 308 KB Correct
13 Correct 48 ms 312 KB Correct
14 Correct 58 ms 364 KB Correct
15 Correct 43 ms 316 KB Correct
16 Correct 48 ms 308 KB Correct
17 Correct 50 ms 412 KB Correct
18 Correct 57 ms 336 KB Correct
19 Correct 1 ms 208 KB Correct
20 Correct 5 ms 208 KB Correct
21 Correct 15 ms 208 KB Correct
22 Correct 55 ms 340 KB Correct
23 Correct 47 ms 296 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 2 ms 208 KB Correct
3 Correct 13 ms 208 KB Correct
4 Correct 44 ms 308 KB Correct
5 Correct 60 ms 420 KB Correct
6 Runtime error 14 ms 360 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 2 ms 208 KB Correct
3 Correct 13 ms 208 KB Correct
4 Correct 44 ms 308 KB Correct
5 Correct 60 ms 420 KB Correct
6 Runtime error 14 ms 360 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 3 ms 208 KB Correct
3 Correct 17 ms 208 KB Correct
4 Correct 57 ms 428 KB Correct
5 Correct 59 ms 304 KB Correct
6 Runtime error 11 ms 408 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 3 ms 208 KB Correct
3 Correct 17 ms 208 KB Correct
4 Correct 57 ms 428 KB Correct
5 Correct 59 ms 304 KB Correct
6 Runtime error 11 ms 408 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -