# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
963675 | Trisanu_Das | Ancient Machine 2 (JOI23_ancient2) | C++17 | 33 ms | 2056 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|---|---|---|---|
Fetching results... |