Submission #306788

#TimeUsernameProblemLanguageResultExecution timeMemory
306788vipghn2003Gondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; int Power(int x,int n) { if(!n) return 1; if(n%2) return 1ll*Power(x,n-1)*x%mod; int tmp=Power(x,n/2); return 1ll*tmp*tmp%mod; } int countReplacement(int n,int inputSeq[]) { vector<int>b(n); for(int i=0;i<n;i++) inputSeq[i]--; int res=0; for(int i=0;i<n;i++) { int cnt=i; bool kt=true; vector<int>cur; for(int j=0;j<n;j++) { if(cnt>=n) cnt=0; b[j]=cnt; cnt++; if(b[j]>inputSeq[j]) kt=false; else { if(inputSeq[j]>(n-1)) cur.push_back(inputSeq[j]-n+1); } } if(!kt) continue; sort(cur.begin(),cur.end()); int sz=cur.size(); int val=Power(sz,cur[0]-1); for(int j=1;j<sz;j++) { if(cur[j]==cur[j-1]) { val=0; break; } val=1ll*val*Power(sz-j,cur[j]-cur[j-1]-1)%mod; } //cout<<val<<'\n'; res=(res+val)%mod; } return res; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; cout<<countReplacement(n,a); }*/

Compilation message (stderr)

/tmp/ccJ1VLhv.o: In function `main':
grader.cpp:(.text.startup+0xa2): undefined reference to `valid'
grader.cpp:(.text.startup+0xee): undefined reference to `countReplacement'
grader.cpp:(.text.startup+0x112): undefined reference to `replacement'
collect2: error: ld returned 1 exit status