답안 #242323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
242323 2020-06-27T08:51:43 Z jamielim 마상시합 토너먼트 (IOI12_tournament) C++14
0 / 100
1000 ms 896 KB
#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

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;
             ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 249 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 896 KB Time limit exceeded
2 Halted 0 ms 0 KB -