# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
419515 | alishahali1382 | Ancient Machine (JOI21_ancient_machine) | C++17 | 86 ms | 8856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;
const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;
bool A[MAXN];
void Anna(int n, vector<char> S){
int posx=n;
for (int i=0; i<n; i++) if (S[i]=='X'){
posx=i;
break ;
}
for (int i=0; i<17; i++) Send(posx>>i&1);
// for (int i=0; i<posx; i++) Send(1);
vector<int> vec;
for (int i=posx; i<n; i++){
if (S[i]=='Z'){
if (i+1<n && S[i+1]=='Z') vec.pb(0);
else vec.pb(1);
}
else vec.pb(0);
}
while (vec.size()%4) vec.pb(0);
string out="";
for (int i=0; i<vec.size();){
string S="";
S+='0'+vec[i++];
S+='0'+vec[i++];
S+='0'+vec[i++];
S+='0'+vec[i++];
if (S=="0000") out+="000";
if (S=="0001") out+="001";
if (S=="0010") out+="010";
if (S=="0100") out+="011";
if (S=="1000") out+="100";
if (S=="1010") out+="101";
if (S=="1001") out+="110";
if (S=="0101") out+="111";
}
for (char ch:out) Send(ch-'0');
}
#include "Bruno.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;
const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;
int n, m, k, u, v, x, y, t, a, b, ans;
char S[MAXN];
int stk[MAXN], sz;
bool mark[MAXN];
inline void Rem(int x){
// debug(x)
// if (mark[x]) debug("fuck")
Remove(x);
mark[x]=1;
}
void Bruno(int n, int m, vector<int> A){
int posx=0;
for (int i=0; i<17; i++) posx|=(A[i]<<i);
for (int i=0; i<posx; i++) Rem(i);
string B="";
for (int i=17; i<m; ){
string S="";
S+='0'+A[i++];
S+='0'+A[i++];
S+='0'+A[i++];
if (S=="000") B+="0000";
if (S=="001") B+="0001";
if (S=="010") B+="0010";
if (S=="011") B+="0100";
if (S=="100") B+="1000";
if (S=="101") B+="1010";
if (S=="110") B+="1001";
if (S=="111") B+="0101";
}
for (int i=posx; i<n; i++){
if (B[i-posx]=='0'){
stk[++sz]=i;
}
else{
while (sz>1) Rem(stk[sz--]);
Rem(i);
}
}
while (sz) Rem(stk[sz--]);
for (int i=0; i<n; i++) if (!mark[i]) Remove(i);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |