Submission #677086

#TimeUsernameProblemLanguageResultExecution timeMemory
677086alvingogoAncient Machine (JOI21_ancient_machine)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue #define int long long using namespace std; vector<int> v; const int A=51,B=73; void init(){ v.clear(); v.push_back(1); v.push_back(1); int x=1; for(int i=0;i<74;i++){ int u=v[i]+v[i+1]; if(u>1e18){ break; } v.push_back(u); } } void sei(int a){ for(int i=A-1;i>=0;i--){ if(a>=(1ll<<i)){ a-=(1ll<<i); Send(1); } else{ Send(0); } } } void Anna(int n,vector<char> s){ init(); string a; int flag=0; for(int i=0;i<n;i++){ if(s[i]=='X'){ if(flag==0){ flag=1; a+='1'; a+='0'; } else{ a+='0'; } } else if(s[i]=='Y'){ a+='0'; } else{ if(flag){ a+='1'; } else{ a+='0'; } } } int g=a.size(); while(g%B!=0){ g++; a+='0'; } for(int i=0;i<g/B;i++){ int x=0; for(int j=0;j<B;j++){ if(a[i*B+j]=='1'){ x+=v[B-j]; } } assert(x<=(1ll<<A)); sei(x); } }
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue #define int long long using namespace std; vector<int> v; const int A=51,B=73; void init(){ v.clear(); v.push_back(1); v.push_back(1); int x=1; for(int i=0;i<74;i++){ int u=v[i]+v[i+1]; if(u>1e18){ break; } v.push_back(u); } } void Bruno(int n,int l,vector<int> a){ init(); string s; for(int i=0;i<l/A;i++){ int zz=1ll<<(A-1); int x=0; for(int j=0;j<A;j++){ if(a[i*A+j]=='1'){ x+=zz; } zz>>=1; } for(int j=B;j>=1;j--){ if(zz>=v[j]){ zz-=v[j]; s+='1'; } else{ s+='0'; } } } int m=0; int flag=0; vector<int> gg(n); for(int i=0;i<n;i++){ if(s[i+m]=='1'){ gg[i]=1; flag=1; m=1; } else{ gg[i]=0; } } vector<int> vis(n); flag=0; int lf=0; for(int i=0;i<n;i++){ if(gg[i]==1){ if(flag){ for(int j=i-1;j>lf;j--){ Remove(j); vis[j]=1; } Remove(i); vis[i]=1; } flag=1; lf=i; } } for(int i=0;i<n;i++){ if(!vis[i]){ Remove(i); } } }

Compilation message (stderr)

Anna.cpp: In function 'void init()':
Anna.cpp:16:6: warning: unused variable 'x' [-Wunused-variable]
   16 |  int x=1;
      |      ^
Anna.cpp: In function 'void sei(long long int)':
Anna.cpp:29:4: error: 'Send' was not declared in this scope
   29 |    Send(1);
      |    ^~~~
Anna.cpp:32:4: error: 'Send' was not declared in this scope
   32 |    Send(0);
      |    ^~~~

Bruno.cpp: In function 'void init()':
Bruno.cpp:16:6: warning: unused variable 'x' [-Wunused-variable]
   16 |  int x=1;
      |      ^
Bruno.cpp: In function 'void Bruno(long long int, long long int, std::vector<long long int>)':
Bruno.cpp:68:21: error: 'Remove' was not declared in this scope; did you mean 'remove'?
   68 |                     Remove(j);
      |                     ^~~~~~
      |                     remove
Bruno.cpp:71:17: error: 'Remove' was not declared in this scope; did you mean 'remove'?
   71 |                 Remove(i);
      |                 ^~~~~~
      |                 remove
Bruno.cpp:80:13: error: 'Remove' was not declared in this scope; did you mean 'remove'?
   80 |             Remove(i);
      |             ^~~~~~
      |             remove