Submission #963675

# Submission time Handle Problem Language Result Execution time Memory
963675 2024-04-15T13:00:48 Z Trisanu_Das Ancient Machine 2 (JOI23_ancient2) C++17
97 / 100
33 ms 2056 KB
#include "ancient2.h"
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
 
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
 
 
const int M = 100;
const int N = 1002;
bitset<N> eq[N];
bool has[N];
bitset<N> cur;
int n;
int id;
 
bool add(){
	for(int i = n - 1; i >= 0 ; i -- ){
		if(cur[i]){
			if(has[i]) cur ^= eq[i];
			else{
				eq[i]=cur;
				has[i]=true;
				id = i;
				return true;
			}
		}
	}
	return false;
}
 
string Solve(int _n) {
	n = _n;
	string s;
	for(int i = 0 ; i < n; i ++ ) s.push_back('0');
	id = 0;
	int total = 0;
	for(int mod = 1; mod < M; mod ++ ){
		for(int x = 0; x < mod ; x ++ ){
			cur.reset();
			for(int y = x; y < n; y += mod) cur[y]=1;
			if(add()){
				total ++ ;
				vector<int> qa(mod * 2), qb(mod * 2);
				for(int i = 0 ; i < mod; i ++ ){
					qa[i] = (i + 1) % mod;
					qb[i] = (i + 1) % mod;
					qa[i + mod] = (i + 1) % mod + mod;
					qb[i + mod] = (i + 1) % mod + mod; 
					if(i == x) swap(qb[i], qb[i + mod]);
				}
				int send = Query(mod * 2, qa, qb);
				if(send >= mod) eq[id].flip(n);
				if(total == n) break;
			}
		}
		if(total == n) break;
	}
	for(int i = 0 ; i < n; i ++ ){
		for(int j = 0 ; j < i ; j ++ ) if(eq[i][j]) eq[i] ^= eq[j];
		if(eq[i][n]) s[i] ++ ;
	}
	return s;
}
# Verdict Execution time Memory Grader output
1 Partially correct 32 ms 1268 KB Output is partially correct
2 Partially correct 29 ms 1808 KB Output is partially correct
3 Partially correct 28 ms 1024 KB Output is partially correct
4 Partially correct 28 ms 1072 KB Output is partially correct
5 Partially correct 27 ms 1540 KB Output is partially correct
6 Partially correct 30 ms 1408 KB Output is partially correct
7 Partially correct 28 ms 1520 KB Output is partially correct
8 Partially correct 28 ms 1408 KB Output is partially correct
9 Partially correct 28 ms 1256 KB Output is partially correct
10 Partially correct 27 ms 1584 KB Output is partially correct
11 Partially correct 30 ms 1136 KB Output is partially correct
12 Partially correct 28 ms 572 KB Output is partially correct
13 Partially correct 28 ms 1040 KB Output is partially correct
14 Partially correct 28 ms 1052 KB Output is partially correct
15 Partially correct 28 ms 1804 KB Output is partially correct
16 Partially correct 30 ms 1036 KB Output is partially correct
17 Partially correct 31 ms 1032 KB Output is partially correct
18 Partially correct 30 ms 1304 KB Output is partially correct
19 Partially correct 28 ms 1788 KB Output is partially correct
20 Partially correct 29 ms 1440 KB Output is partially correct
21 Partially correct 29 ms 2056 KB Output is partially correct
22 Partially correct 29 ms 1524 KB Output is partially correct
23 Partially correct 29 ms 1284 KB Output is partially correct
24 Partially correct 28 ms 1060 KB Output is partially correct
25 Partially correct 28 ms 1396 KB Output is partially correct
26 Partially correct 28 ms 1384 KB Output is partially correct
27 Partially correct 28 ms 1404 KB Output is partially correct
28 Partially correct 28 ms 1688 KB Output is partially correct
29 Partially correct 30 ms 1320 KB Output is partially correct
30 Partially correct 28 ms 1464 KB Output is partially correct
31 Partially correct 29 ms 1820 KB Output is partially correct
32 Partially correct 28 ms 776 KB Output is partially correct
33 Partially correct 28 ms 1536 KB Output is partially correct
34 Partially correct 31 ms 1032 KB Output is partially correct
35 Partially correct 31 ms 1308 KB Output is partially correct
36 Partially correct 29 ms 956 KB Output is partially correct
37 Partially correct 33 ms 1772 KB Output is partially correct
38 Partially correct 28 ms 1388 KB Output is partially correct
39 Partially correct 29 ms 1288 KB Output is partially correct
40 Partially correct 29 ms 1704 KB Output is partially correct
41 Partially correct 29 ms 1028 KB Output is partially correct
42 Partially correct 30 ms 1316 KB Output is partially correct
43 Partially correct 30 ms 1672 KB Output is partially correct
44 Partially correct 31 ms 1404 KB Output is partially correct
45 Partially correct 32 ms 1552 KB Output is partially correct
46 Partially correct 32 ms 1540 KB Output is partially correct
47 Partially correct 29 ms 1512 KB Output is partially correct
48 Partially correct 28 ms 1588 KB Output is partially correct
49 Partially correct 29 ms 1772 KB Output is partially correct
50 Partially correct 32 ms 1068 KB Output is partially correct
51 Partially correct 29 ms 1288 KB Output is partially correct
52 Partially correct 29 ms 2000 KB Output is partially correct
53 Partially correct 28 ms 1260 KB Output is partially correct
54 Partially correct 28 ms 1304 KB Output is partially correct
55 Partially correct 28 ms 1044 KB Output is partially correct
56 Partially correct 29 ms 1640 KB Output is partially correct
57 Partially correct 32 ms 1296 KB Output is partially correct
58 Partially correct 31 ms 1292 KB Output is partially correct
59 Partially correct 28 ms 1320 KB Output is partially correct
60 Partially correct 28 ms 1068 KB Output is partially correct
61 Partially correct 28 ms 1292 KB Output is partially correct
62 Partially correct 29 ms 1400 KB Output is partially correct
63 Partially correct 29 ms 1380 KB Output is partially correct