Submission #1153507

#TimeUsernameProblemLanguageResultExecution timeMemory
1153507modwweAncient Machine (JOI21_ancient_machine)C++20
Compilation error
0 ms0 KiB
//#include "gap.h" //#include "mushrooms.h" #include "Anna.h" #pragma GCC optimize("Ofast,unroll-loops") #include<bits/stdc++.h> //#define ll long long #define ll long long #define down cout<<'\n'; #define debug cout<<" cucuucucuuu",down #define modwwe int t;cin>>t; while(t--) #define bit(i,j) (i>>j&1) #define sobit(a) __builtin_popcountll(a) #define task2 "ftree" #define task "test" #define fin(x) freopen(x".inp","r",stdin) #define fou(x) freopen(x".out","w",stdout) #define pb push_back #define mask(k) (1ll<<k) #define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms"; using namespace std; #define getchar_unlocked getchar mt19937 rd(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l,int r) { return uniform_int_distribution<int>(l,r)(rd); } void phongbeo(); const ll inf = 1e18; const ll mod2 = 1e9+7; const ll base=67; ll n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, mid, l2, r2, center; ll i, s10, s12,k1,k2,k3,s11,lim,w,l,r ; ll kk; ll t; ll el = 19; ll f[201]; ll a[201]; bool c[100001];/* vector<int> send; void Send(ll x) { send.pb(x); }*/ ll decode(string s) { ll ss=0; for(ll i=0; i<s.size(); i++) if(s[i]=='1'){ ss+=f[62-i]; } return ss; } string encode(string s,ll sz) { ll ss=0; for(ll i=0; i<s.size(); i++) ss=ss+mask(i)*(s[i]-'0'); ss++; string sc; for(ll i=0; i<sz; i++) if(f[62-i]<ss) { ss-=f[62-i]; sc=sc+'1'; } else sc=sc+'0'; return sc; } string changebit(ll x) { string s; for(ll i=0; i<44; i++) if(bit(x,i)) s=s+'1'; else s=s+'0'; return s; } void build() { f[0]=1; f[1]=2; f[2]=3; for(ll i=2; i<=63; i++) f[i]=f[i-1]+f[i-2]; } void Anna(int n,vector<char>a) { bool de=0; build(); for(ll i=0; i<a.size(); i++) { if(!de&&i!=a.size()-1&&a[i+1]=='X')continue; if(de&&i!=a.size()-1&&a[i+1]=='Z') continue; if(!de&&a[i]=='X') { c[i]=1; de=1; i++; } else if(de&&a[i]=='Z') c[i]=1; } string s; for(ll i=0; i<n; i++) { if(i!=n-1&&c[i]==c[i+1]&&c[i]==1)assert(0); if(c[i])s=s+"1"; else s=s+"0"; if(i!=0) if(i%63==0||i==n-1) { s5=decode(s); // cout<<s5,down string sc=changebit(s5); for(ll i=0; i<sc.size(); i++) Send(sc[i]-'0'); s=""; } } } /* void phongbeo() { s4=0; Anna(5, {'Y','X','Z','Y','Z'}); string s; // for(auto x:send) // cout<<x; // down Bruno(5,0,send); } */
//#include "gap.h" //#include "mushrooms.h" #include "Bruno.h" #pragma GCC optimize("Ofast,unroll-loops") #include<bits/stdc++.h> //#define int long long #define ll long long #define down cout<<'\n'; #define debug cout<<" cucuucucuuu",down #define modwwe int t;cin>>t; while(t--) #define bit(i,j) (i>>j&1) #define sobit(a) __builtin_popcountll(a) #define task2 "ftree" #define task "test" #define fin(x) freopen(x".inp","r",stdin) #define fou(x) freopen(x".out","w",stdout) #define pb push_back #define mask(k) (1ll<<k) #define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms"; using namespace std; #define getchar_unlocked getchar mt19937 rd(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l,int r) { return uniform_int_distribution<int>(l,r)(rd); } void phongbeo(); const ll inf = 1e18; const ll mod2 = 1e9+7; const ll base=67; ll n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, mid, l2, r2, center; ll i, s10, s12,k1,k2,k3,s11,lim,w,l,r ; ll kk; ll t; ll el = 19; main() { if(fopen(task2".inp","r")) { fin(task2); fou(task2); } if(fopen(task".inp","r")) { fin(task); fou(task); } ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); /// cin>>s1; //ll t;cin>>t; while(t--) phongbeo(); // checktime } ll f[201]; ll a[201]; bool c[100001]; vector<int> send; void Send(ll x) { send.pb(x); } ll decode(string s) { ll ss=0; for(ll i=0; i<s.size(); i++) if(s[i]=='1'){ ss+=f[62-i]; } return ss; } string encode(string s,ll sz) { ll ss=0; for(ll i=0; i<s.size(); i++) ss=ss+mask(i)*(s[i]-'0'); ss++; string sc; for(ll i=0; i<sz; i++) if(f[62-i]<ss) { ss-=f[62-i]; sc=sc+'1'; } else sc=sc+'0'; return sc; } string changebit(ll x) { string s; for(ll i=0; i<44; i++) if(bit(x,i)) s=s+'1'; else s=s+'0'; return s; } void build() { f[0]=1; f[1]=2; f[2]=3; for(ll i=2; i<=63; i++) f[i]=f[i-1]+f[i-2]; } vector<int> v; void Bruno(int n,int L,vector<int> a) { build(); string haha,s; ll sz=n; for(ll i=0; i<a.size(); i++) { if(a[i]==1)s=s+'1'; else s=s+'0'; if(i!=0&&i%44==43) { haha=haha+encode(s,min(sz,63ll)); s=""; sz-=63; } } v.pb(-1); for(ll i=0; i<haha.size(); i++) if(haha[i]=='1') v.pb(i); if(v.back()!=n-1) v.pb(n-1); for(ll i=1; i<v.size(); i++) { for(ll j=v[i]-1; j>v[i-1]; --j) Remove(j); if(i==1) continue; Remove(v[i]); } Remove(v[1]); }/* void phongbeo() { s4=0; Anna(5, {'Y','X','Z','Y','Z'}); string s; // for(auto x:send) // cout<<x; // down Bruno(5,0,send); } */

Compilation message (stderr)

# 2번째 컴파일 단계

Bruno.cpp:36:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   36 | main()
      | ^~~~
Bruno.cpp: In function 'int main()':
Bruno.cpp:15:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 | #define fin(x) freopen(x".inp","r",stdin)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~
Bruno.cpp:40:9: note: in expansion of macro 'fin'
   40 |         fin(task2);
      |         ^~~
Bruno.cpp:16:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 | #define fou(x) freopen(x".out","w",stdout)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~
Bruno.cpp:41:9: note: in expansion of macro 'fou'
   41 |         fou(task2);
      |         ^~~
Bruno.cpp:15:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 | #define fin(x) freopen(x".inp","r",stdin)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~
Bruno.cpp:45:9: note: in expansion of macro 'fin'
   45 |         fin(task);
      |         ^~~
Bruno.cpp:16:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 | #define fou(x) freopen(x".out","w",stdout)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~
Bruno.cpp:46:9: note: in expansion of macro 'fou'
   46 |         fou(task);
      |         ^~~
/usr/bin/ld: /tmp/cc1d6iuU.o: in function `main':
grader_bruno.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cchlCywe.o:Bruno.cpp:(.text.startup+0x20): first defined here
/usr/bin/ld: /tmp/cchlCywe.o: in function `main':
Bruno.cpp:(.text.startup+0xd6): undefined reference to `phongbeo()'
collect2: error: ld returned 1 exit status