Submission #242323

#TimeUsernameProblemLanguageResultExecution timeMemory
242323jamielimJousting tournament (IOI12_tournament)C++14
0 / 100
1093 ms896 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> ii; typedef long double ld; #define mp make_pair #define pb push_back #define fi first #define se second #define ALL(x) x.begin(),x.end() #define SZ(x) (int)x.size() const int INF=2012345678; const ll LLINF=4012345678012345678LL; const ll MOD=1000000007; //998244353; // const ld PI=3.1415926535898; const ld EPS=1e-9; ll gcd(ll a,ll b){if(a<b)swap(a,b);if(b==0)return a;return gcd(b,a%b);} inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;} inline ll expo(ll b,ll p,ll m){ll res=1; while(p){if(p&1)res=(res*b)%m; b=(b*b)%m; p>>=1;} return res;} inline ll modinv(ll a,ll m){return expo(a,m-2,m);} int GetBestPosition(int N, int C, int R, int *K, int *S, int *E){ int maxi=0,ans=0; for(int p=0;p<N;p++){ int cur=0; int arr[N];arr[p]=R; for(int i=0;i<N;i++){ if(i<p)arr[i]=K[i]; else if(i>p)arr[i]=K[i-1]; } for(int i=0;i<C;i++){ int m=0; for(int j=S[i];j<=E[i];j++){ m=max(m,arr[j]); } arr[S[i]]=m; if(m==R)cur++; for(int j=S[i]+1;j<N-E[i]+S[i];j++){ arr[j]=arr[j+E[i]-S[i]]; } } if(cur>maxi){maxi=cur;ans=p;} } return maxi; }

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:25:13: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
  int maxi=0,ans=0;
             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...