Submission #1250388

#TimeUsernameProblemLanguageResultExecution timeMemory
1250388alex0152Triple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int nMax=2e5+5; long long count_triples(vector<int> H) { int n=H.size(),a[3],b[3],cand[10],cnt,p,x,y,z; long long ans=0; bool ok=1,ok1=1; for(int i=0; i<n; ++i) { if(H[i]>10) ok=0; if(i!=0 && H[i]<H[i-1]) ok1=0; } if(ok1) { for(int i=2; i<n; ++i) { if(i-H[i]>=0) { x=i-H[i]; z=i; y=x+H[x]; a[0]=H[x],a[1]=H[y],a[2]=H[z]; b[0]=z-y,b[1]=z-x,b[2]=y-x; sort(a,a+3); sort(b,b+3); if(a[0]==b[0] && a[1]==b[1] && a[2]==b[2]) ans++; if(x+H[x]!=z-H[x]) { y=z-H[x]; a[0]=H[x],a[1]=H[y],a[2]=H[z]; b[0]=z-y,b[1]=z-x,b[2]=y-x; sort(a,a+3); sort(b,b+3); if(a[0]==b[0] && a[1]==b[1] && a[2]==b[2]) ans++; } } } } else if(!ok) { for(int i=0; i<n-2; ++i) for(int j=i+2; j<n; ++j) { cnt=0; if(i+H[i]<j) cand[++cnt]=i+H[i]; if(i+H[j]<j) cand[++cnt]=i+H[j]; if(j-H[i]>i) cand[++cnt]=j-H[i]; if(j-H[j]>i) cand[++cnt]=j-H[j]; sort(cand+1,cand+cnt+1); for(int q=1; q<=cnt; ++q) if(q==1 || cand[q]!=cand[q-1]) { p=cand[q]; a[0]=H[i],a[1]=H[j],a[2]=H[p]; b[0]=j-i,b[1]=p-i,b[2]=j-p; sort(a,a+3); sort(b,b+3); if(a[0]==b[0] && a[1]==b[1] && a[2]==b[2]) ans++; } } } else { for(int i=0; i<n-2; ++i) for(int j=i+1; j<min(i+10,n-1); ++j) for(int p=j+1; p<min(i+11,n); ++p) { a[0]=H[i],a[1]=H[j],a[2]=H[p]; b[0]=j-i,b[1]=p-i,b[2]=p-j; sort(a,a+3); sort(b,b+3); if(a[0]==b[0] && a[1]==b[1] && a[2]==b[2]) ans++; } } return ans; } vector<int> construct_range(int M, int K) { vector<int> schema; int idk[6]; idk[1]=1,idk[2]=2,idk[3]=1,idk[4]=1,idk[5]=3; int cnt=0,x; for(int i=0; i<M; ++i) { if(cnt==5) cnt=0; cnt++; x=idk[cnt]; schema.push_back(x); } return schema; } int main() { vector<int> schema; int cnt=0,x,M=20; int idk[6]; idk[1]=1,idk[2]=2,idk[3]=1,idk[4]=1,idk[5]=3; for(int i=0; i<M; ++i) { if(cnt==5) cnt=0; cnt++; x=idk[cnt]; schema.push_back(x); } for(int i=0; i<M; ++i) cout<<schema[i]<<" "; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccJm3QqL.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccXbOQjh.o:triples.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status