Submission #899055

#TimeUsernameProblemLanguageResultExecution timeMemory
899055weajinkAncient Machine 2 (JOI23_ancient2)C++17
Compilation error
0 ms0 KiB
#include "ancient2.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; //Autor: Michał Szeliga #ifdef LOCAL #define debug(...) __VA_ARGS__; #else #define debug(...) {} #endif #define read(...) debug((void)!freopen(__VA_ARGS__,"r",stdin);); const int M = 1001; bitset<M> akt[1000]; int ile = 0; int gauss(bitset<M> x){ int i; for (i = 0; i < M-1; i++){ if (!akt[i] && x[i]){ akt[i] = x; ile++; return i; } x ^= akt[i]; wy ^= ans[i]; } return -1; } bool policz(int x){ bitset<1001> wy; wy[x] = 1; for (int i = 0; i < M-1; i++){ if (wy[i]) wy ^= akt[i]; } return wy[1000]; } void stworz_automat(int c, int r){ bitset<int> wy; for (int i = r; i < M-1; i += c) wy[i] = 1; int id = gauss(wy); if (id != -1){ int m = 2*c; vector<int> A,B; for (i = 0; < c; i++){ if ((i+1)%c == r){ A.push_back(r); B.push_back(c+r); }else{ A.push_back(i+1); B.push_back(i+1); } } for (i = c; i < 2*c; i++){ if ((i+1)%c == r){ A.push_back(r); B.push_back(c+r); }else{ A.push_back(i+1); B.push_back(i+1); } } akt[id][1000] = (Query(m,A,B) >= c); } } string Solve(int n){ int i; for (int c = 1; c < 1000; i++){ for (int r = 0; r < c; r++){ stworz_automat(c,r); if (ile == 1000) break; } } string wy; for (int i = 0; i < n; i++){ if (policz(i)) wy += '1'; else wy += '0'; } return wy; }

Compilation message (stderr)

ancient2.cpp: In function 'int gauss(std::bitset<1001>)':
ancient2.cpp:19:7: error: no match for 'operator!' (operand type is 'std::bitset<1001>')
   19 |   if (!akt[i] && x[i]){
      |       ^~~~~~~
ancient2.cpp:19:7: note: candidate: 'operator!(bool)' (built-in)
ancient2.cpp:19:7: note:   no known conversion for argument 1 from 'std::bitset<1001>' to 'bool'
ancient2.cpp:25:3: error: 'wy' was not declared in this scope
   25 |   wy ^= ans[i];
      |   ^~
ancient2.cpp:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   wy ^= ans[i];
      |         ^~~
      |         abs
ancient2.cpp: In function 'void stworz_automat(int, int)':
ancient2.cpp:38:12: error: type/value mismatch at argument 1 in template parameter list for 'template<long unsigned int _Nb> class std::bitset'
   38 |  bitset<int> wy;
      |            ^
ancient2.cpp:38:12: note:   expected a constant of type 'long unsigned int', got 'int'
ancient2.cpp:39:37: error: invalid types 'int[int]' for array subscript
   39 |  for (int i = r; i < M-1; i += c) wy[i] = 1;
      |                                     ^
ancient2.cpp:44:8: error: 'i' was not declared in this scope
   44 |   for (i = 0; < c; i++){
      |        ^
ancient2.cpp:44:15: error: expected primary-expression before '<' token
   44 |   for (i = 0; < c; i++){
      |               ^
ancient2.cpp:53:8: error: 'i' was not declared in this scope
   53 |   for (i = c; i < 2*c; i++){
      |        ^