Submission #897765

# Submission time Handle Problem Language Result Execution time Memory
897765 2024-01-03T16:14:21 Z AdamGS Ancient Machine 2 (JOI23_ancient2) C++17
97 / 100
42 ms 1580 KB
#include "ancient2.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
bitset<1001>B[1000];
bool dodaj(bitset<1001>T) {
  rep(i, 1000) if(T[i]) {
    if(!B[i][i]) {
      B[i]=T;
      return true;
    }
    T^=B[i];
  }
  return false;
}
char znajdz(int x) {
  bitset<1001>T;
  T[x]=1;
  rep(i, 1000) if(T[i]) T^=B[i];
  return T[1000]+'0';
}
string Solve(int n) {
  vector<pair<int,int>>baza;
  for(int i=1; baza.size()<1000; ++i) {
    rep(j, i) {
      bitset<1001>T;
      for(int p=j; p<1000; p+=i) T[p]=1;
      if(dodaj(T)) baza.pb({i, j});
    }
  }
  rep(i, 1000) rep(j, 1001) B[i][j]=0;
  for(auto i : baza) {
    vector<int>a(2*i.st), b(2*i.st);
    rep(j, i.st) {
      a[j]=b[j]=(j+1)%i.st;
      a[j+i.st]=b[j+i.st]=(j+1)%i.st+i.st;
      if(j==i.nd) {
        b[j]+=i.st;
        b[j+i.st]-=i.st;
      }
    }
    bitset<1001>T;
    for(int p=i.nd; p<1000; p+=i.st) T[p]=1;
    if(Query(2*i.st, a, b)>=i.st) T[1000]=1;
    dodaj(T);
  }
  string ans="";
  rep(i, 1000) ans+=znajdz(i);
  return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 35 ms 1320 KB Output is partially correct
2 Partially correct 35 ms 1080 KB Output is partially correct
3 Partially correct 37 ms 1060 KB Output is partially correct
4 Partially correct 36 ms 1352 KB Output is partially correct
5 Partially correct 42 ms 816 KB Output is partially correct
6 Partially correct 39 ms 1060 KB Output is partially correct
7 Partially correct 35 ms 1080 KB Output is partially correct
8 Partially correct 35 ms 1324 KB Output is partially correct
9 Partially correct 34 ms 832 KB Output is partially correct
10 Partially correct 34 ms 872 KB Output is partially correct
11 Partially correct 35 ms 828 KB Output is partially correct
12 Partially correct 35 ms 820 KB Output is partially correct
13 Partially correct 37 ms 604 KB Output is partially correct
14 Partially correct 35 ms 1112 KB Output is partially correct
15 Partially correct 35 ms 868 KB Output is partially correct
16 Partially correct 35 ms 864 KB Output is partially correct
17 Partially correct 35 ms 868 KB Output is partially correct
18 Partially correct 37 ms 860 KB Output is partially correct
19 Partially correct 35 ms 1124 KB Output is partially correct
20 Partially correct 34 ms 836 KB Output is partially correct
21 Partially correct 35 ms 604 KB Output is partially correct
22 Partially correct 34 ms 864 KB Output is partially correct
23 Partially correct 37 ms 1580 KB Output is partially correct
24 Partially correct 35 ms 828 KB Output is partially correct
25 Partially correct 36 ms 1120 KB Output is partially correct
26 Partially correct 35 ms 604 KB Output is partially correct
27 Partially correct 34 ms 824 KB Output is partially correct
28 Partially correct 36 ms 1376 KB Output is partially correct
29 Partially correct 34 ms 1092 KB Output is partially correct
30 Partially correct 36 ms 824 KB Output is partially correct
31 Partially correct 36 ms 860 KB Output is partially correct
32 Partially correct 35 ms 604 KB Output is partially correct
33 Partially correct 35 ms 832 KB Output is partially correct
34 Partially correct 36 ms 1120 KB Output is partially correct
35 Partially correct 35 ms 1576 KB Output is partially correct
36 Partially correct 34 ms 1120 KB Output is partially correct
37 Partially correct 39 ms 600 KB Output is partially correct
38 Partially correct 35 ms 832 KB Output is partially correct
39 Partially correct 40 ms 860 KB Output is partially correct
40 Partially correct 35 ms 1324 KB Output is partially correct
41 Partially correct 35 ms 1084 KB Output is partially correct
42 Partially correct 34 ms 604 KB Output is partially correct
43 Partially correct 35 ms 612 KB Output is partially correct
44 Partially correct 36 ms 584 KB Output is partially correct
45 Partially correct 34 ms 824 KB Output is partially correct
46 Partially correct 35 ms 1352 KB Output is partially correct
47 Partially correct 35 ms 604 KB Output is partially correct
48 Partially correct 35 ms 1072 KB Output is partially correct
49 Partially correct 36 ms 1368 KB Output is partially correct
50 Partially correct 37 ms 1072 KB Output is partially correct
51 Partially correct 34 ms 836 KB Output is partially correct
52 Partially correct 35 ms 864 KB Output is partially correct
53 Partially correct 35 ms 1076 KB Output is partially correct
54 Partially correct 35 ms 816 KB Output is partially correct
55 Partially correct 40 ms 864 KB Output is partially correct
56 Partially correct 36 ms 1108 KB Output is partially correct
57 Partially correct 35 ms 828 KB Output is partially correct
58 Partially correct 36 ms 828 KB Output is partially correct
59 Partially correct 38 ms 1328 KB Output is partially correct
60 Partially correct 36 ms 1368 KB Output is partially correct
61 Partially correct 34 ms 1076 KB Output is partially correct
62 Partially correct 35 ms 832 KB Output is partially correct
63 Partially correct 35 ms 1120 KB Output is partially correct