Submission #776533

#TimeUsernameProblemLanguageResultExecution timeMemory
776533jamezzzFish (IOI08_fish)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define fi first #define se second #define pb push_back #define sz(x) ((int)x.size()) #define all(x) x.begin(),x.end() #define LINF 1023456789123456789 typedef long long ll; typedef pair<int,int> ii; typedef pair<ll,int> li; #define maxn 500005 #define maxk 500005 int n,k,m,cnt[maxk],bad[maxk],num[maxk][maxk]; ll mn[maxn]; vector<ii> v; int main(){ sf("%d%d%d",&n,&k,&m); for(int i=0;i<n;++i){ int l,c; sf("%d%d",&l,&c); v.pb({l,c}); ++cnt[c]; } sort(all(v)); int ptr=n-1; ll ans=0; fill(mn,mn+n+1,1); for(int i=n-1;i>=0;--i){ int c=v[i].se; if(bad[c])continue; while(ptr>=0&&v[i].fi<2*v[ptr].fi){ --cnt[v[ptr].se]; --ptr; } vector<int> undo; for(int j=1;j<=k;++j){ if(c==j)continue; int x=num[c][j]; if(x<=cnt[c]+1){ mn[x+1]*=(cnt[j]+1); mn[x+1]%=m; undo.pb(x+1); } } ll add=1; for(int j=1;j<=cnt[c]+1;++j){ add*=mn[j]; add%=m; ans+=add; ans%=m; } for(int x:undo)mn[x]=1; for(int j=1;j<=k;++j){ num[j][c]=cnt[j]; } bad[c]=1; } pf("%lld\n",ans); } /* 5 3 7 2 2 4 1 8 3 4 1 2 3 */

Compilation message (stderr)

fish.cpp: In function 'int main()':
fish.cpp:24:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  sf("%d%d%d",&n,&k,&m);
      |    ^
fish.cpp:27:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |   sf("%d%d",&l,&c);
      |     ^
/tmp/cc3QHWkA.o: in function `main':
fish.cpp:(.text.startup+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x10): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x8f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x15c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x1aa): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x1fd): relocation truncated to fit: R_X86_64_PC32 against symbol `bad' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x255): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc3QHWkA.o
fish.cpp:(.text.startup+0x2d7): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status