답안 #912998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
912998 2024-01-20T05:12:03 Z Muhammad_Aneeq 마상시합 토너먼트 (IOI12_tournament) C++17
17 / 100
1000 ms 3172 KB
#include <iostream>
#include <vector>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int GetBestPosition(int N, int C, int R, int K[], int S[], int E[])
{
	int ans=0,pos=0;
	ordered_set s;
	for (int i=0;i<N;i++)
	{
		s={};
		for (int j=0;j<N;j++)
			s.insert(j);
		int z=0;
		for (int j=0;j<C;j++)
		{
			int ma=0;
			bool w=0;
			for (int k=S[j];k<=E[j];k++)
			{
				int z=*s.find_by_order(k);
				int f=0;
				if (z==i)
				{
					w=1;
					f=R;
				}
				else
					f=K[z-(z>i)];
				ma=max(ma,f);
			}
			for (int k=E[j];k>=S[j];k--)
			{
				auto z=s.find_by_order(k);
				int f=0;
				if (*z==i)
					f=R;
				else
					f=K[*z-(*z>i)];
				if (ma==f)
					continue;
				s.erase(z);
			}
			if (w)
			{
				if (ma==R)
					z++;
				else
					break;
			}
		}
		if (z>ans)
		{
			ans=z;
			pos=i;
		}
	}
	return pos;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 38 ms 592 KB Output is correct
4 Correct 37 ms 456 KB Output is correct
5 Correct 34 ms 348 KB Output is correct
6 Correct 36 ms 436 KB Output is correct
7 Correct 33 ms 348 KB Output is correct
8 Correct 35 ms 348 KB Output is correct
9 Correct 36 ms 348 KB Output is correct
10 Correct 30 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 233 ms 464 KB Output is correct
2 Execution timed out 1029 ms 600 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1006 ms 3172 KB Time limit exceeded
2 Halted 0 ms 0 KB -