Submission #542038

#TimeUsernameProblemLanguageResultExecution timeMemory
542038Sho10Gondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho //#include "gondola.h" using ll=long long; using ld=long double; int const INF=1000000005; ll const LINF=1000000000000000005; ll const mod=1000000007; ld const PI=3.14159265359; #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define f first #define s second #define pb push_back #define mp make_pair #define endl '\n' #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; int valid(int n,int a[]){ int mn=INF,pos=-1; map<ll,ll>viz; for(int i=0;i<n;i++) { viz[a[i]]++; if(a[i]<mn){ mn=a[i]; pos=i; } } for(ll i=0;i<n;i++) { if(viz[a[i]]>=2){ return 0; } } if(mn>n){ return 1; } int b[200005]; for(int i=0;i<n;i++) { b[i]=a[i]; } a[0]=b[pos]; ll val=0; for(ll i=pos+1;i<n;i++) { a[i-pos]=b[i]; val=i-pos; } val++; for(ll i=0;i<pos;i++) { a[val]=b[i]; val++; } ll x=a[0]; x++; b[0]=a[0]; for(ll i=1;i<n;i++) { x%=n; if(x==0){ x=n; } b[i]=x; x++; } for(ll i=1;i<n;i++) { if(b[i]!=a[i]){ if(a[i]<=n){ return 0; } } } return 1; } int replacement(int n,int a[],int g[]){ int mn=INF,pos=-1; map<ll,ll>viz; for(int i=0;i<n;i++) { viz[a[i]]++; if(a[i]<mn){ mn=a[i]; pos=i; } } for(ll i=0;i<n;i++) { if(viz[a[i]]>=2){ return 0; } } if(mn>n){ return 1; } int b[200005]; for(int i=0;i<n;i++) { b[i]=a[i]; } a[0]=b[pos]; ll val=0; for(ll i=pos+1;i<n;i++) { a[i-pos]=b[i]; val=i-pos; } val++; for(ll i=0;i<pos;i++) { a[val]=b[i]; val++; } ll x=a[0]; x++; b[0]=a[0]; for(ll i=1;i<n;i++) { x%=n; if(x==0){ x=n; } b[i]=x; x++; } vector<int>ans; for(ll i=0;i<n;i++) { if(a[i]>n){ ans.pb(i+1); } } int res=ans.size(); for(int i=0;i<res;i++) { g[i]=ans[i]; } return res; } int countReplacement(int n,int a[]){ return 0; } /* int32_t main(){ int n,a[15]; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; } cout<<valid(n,a)<<endl; } */

Compilation message (stderr)

/usr/bin/ld: /tmp/cc6C84sJ.o: in function `main':
grader.cpp:(.text.startup+0xb6): undefined reference to `valid'
/usr/bin/ld: grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x132): undefined reference to `replacement'
collect2: error: ld returned 1 exit status