Submission #1153319

#TimeUsernameProblemLanguageResultExecution timeMemory
1153319modwweAncient Machine (JOI21_ancient_machine)C++20
Compilation error
0 ms0 KiB
//#include "gap.h" //#include "mushrooms.h" //#include "island.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 int inf = 1e18; const ll mod2 = 1e9+7; const ll base=67; int 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; int i, s10, s12,k1,k2,k3,s11,lim,w,l,r ; int kk; int t; int 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; //int t;cin>>t; while(t--) phongbeo(); // checktime } int f[201]; int a[201]; bool c[100001]; vector<int> send; void Send(int x) { send.pb(x); } int decode(string s) { int ss=0; for(int i=0; i<s.size(); i++) if(s[i]=='1') ss+=f[62-i]; return ss; } string encode(string s,int sz) { int ss=0; for(int i=0; i<s.size(); i++) ss=ss+mask(i)*(s[i]-'0'); ss++; string sc; for(int 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(int x) { string s; for(int 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(int 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(int 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; } else if(de&&a[i]=='Z') c[i]=1; } string s; for(int i=0; i<n; i++) { if(c[i])s=s+"1"; else s=s+"0"; if(i!=0) if(i%63==0||i==n-1) { s5=decode(s); string sc=changebit(s5); for(int i=0; i<sc.size(); i++) Send(sc[i]-'0'); s=""; } } } vector<int> v; void Remove(int x) { cout<<x<<" "; } void Bruno(int n,int L,vector<int> a) { build(); string haha,s; int sz=n; for(int 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(int i=0; i<haha.size(); i++) if(haha[i]=='1') v.pb(i); if(v.back()!=n-1) v.pb(n-1); for(int i=1; i<v.size(); i++) { for(int 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, {'X','Y','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,v; 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 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; //(5, {'X','Y','Z','Y','Z'}); string s; for(auto x:send) if(x==1)s=s+'1'; else s=s+'0'; cout<<encode(s,5); } */

Compilation message (stderr)

# 1번째 컴파일 단계

Anna.cpp:36:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   36 | main()
      | ^~~~
Anna.cpp: In function 'int main()':
Anna.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)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~
Anna.cpp:40:9: note: in expansion of macro 'fin'
   40 |         fin(task2);
      |         ^~~
Anna.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)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~
Anna.cpp:41:9: note: in expansion of macro 'fou'
   41 |         fou(task2);
      |         ^~~
Anna.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)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~
Anna.cpp:45:9: note: in expansion of macro 'fin'
   45 |         fin(task);
      |         ^~~
Anna.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)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~
Anna.cpp:46:9: note: in expansion of macro 'fou'
   46 |         fou(task);
      |         ^~~
/usr/bin/ld: /tmp/ccrw0PBR.o: in function `main':
grader_anna.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccLbn7r6.o:Anna.cpp:(.text.startup+0x20): first defined here
/usr/bin/ld: /tmp/ccLbn7r6.o: in function `main':
Anna.cpp:(.text.startup+0xd6): undefined reference to `phongbeo()'
/usr/bin/ld: /tmp/ccrw0PBR.o: in function `main':
grader_anna.cpp:(.text.startup+0x140): undefined reference to `Anna(int, std::vector<char, std::allocator<char> >)'
collect2: error: ld returned 1 exit status