답안 #693017

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
693017 2023-02-02T09:03:23 Z Pyqe 송신탑 (IOI22_towers) C++17
11 / 100
4000 ms 1872 KB
#include <bits/stdc++.h>
#include "towers.h"

using namespace std;

#define mp make_pair
#define fr first
#define sc second

const long long inf=1e18;
long long a[100069];
 
void init(int n,vector<int> aa)
{
	long long i;
	
	for(i=1;i<=n;i++)
	{
		a[i]=aa[i-1];
	}
}

int max_towers(int lb,int rb,int cw)
{
	lb++;
	rb++;
	if(lb==rb)
	{
		return 1;
	}
	else
	{
		long long i,j,mn,mx,z=rb-lb+1;
		
		for(i=lb;i<=rb;i++)
		{
			mn=inf;
			mx=-inf;
			for(j=i-1;j>=lb;j--)
			{
				if(a[j]<a[i])
				{
					break;
				}
				mx=max(mx,a[j]);
			}
			if(j>=lb)
			{
				mn=min(mn,mx);
			}
			mx=-inf;
			for(j=i+1;j<=rb;j++)
			{
				if(a[j]<a[i])
				{
					break;
				}
				mx=max(mx,a[j]);
			}
			if(j<=rb)
			{
				mn=min(mn,mx);
			}
			if(mn-a[i]<cw)
			{
				z--;
			}
		}
		return z;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4054 ms 1196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 0 ms 336 KB Output is correct
23 Correct 3 ms 336 KB Output is correct
24 Correct 2 ms 336 KB Output is correct
25 Correct 0 ms 208 KB Output is correct
26 Correct 1 ms 208 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 3 ms 336 KB Output is correct
33 Correct 3 ms 336 KB Output is correct
34 Correct 2 ms 208 KB Output is correct
35 Correct 2 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 0 ms 336 KB Output is correct
23 Correct 3 ms 336 KB Output is correct
24 Correct 2 ms 336 KB Output is correct
25 Correct 0 ms 208 KB Output is correct
26 Correct 1 ms 208 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 3 ms 336 KB Output is correct
33 Correct 3 ms 336 KB Output is correct
34 Correct 2 ms 208 KB Output is correct
35 Correct 2 ms 336 KB Output is correct
36 Correct 9 ms 1332 KB Output is correct
37 Correct 15 ms 1848 KB Output is correct
38 Correct 21 ms 1840 KB Output is correct
39 Correct 11 ms 1828 KB Output is correct
40 Correct 12 ms 1836 KB Output is correct
41 Correct 13 ms 1872 KB Output is correct
42 Correct 21 ms 1840 KB Output is correct
43 Correct 1276 ms 1832 KB Output is correct
44 Correct 102 ms 1832 KB Output is correct
45 Correct 13 ms 1736 KB Output is correct
46 Correct 21 ms 1840 KB Output is correct
47 Correct 21 ms 1744 KB Output is correct
48 Correct 11 ms 1848 KB Output is correct
49 Correct 19 ms 1844 KB Output is correct
50 Correct 245 ms 1836 KB Output is correct
51 Correct 764 ms 1828 KB Output is correct
52 Correct 22 ms 1864 KB Output is correct
53 Correct 14 ms 1872 KB Output is correct
54 Correct 14 ms 1852 KB Output is correct
55 Execution timed out 4038 ms 1832 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4067 ms 1788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4030 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 0 ms 336 KB Output is correct
23 Correct 3 ms 336 KB Output is correct
24 Correct 2 ms 336 KB Output is correct
25 Correct 0 ms 208 KB Output is correct
26 Correct 1 ms 208 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 3 ms 336 KB Output is correct
33 Correct 3 ms 336 KB Output is correct
34 Correct 2 ms 208 KB Output is correct
35 Correct 2 ms 336 KB Output is correct
36 Correct 9 ms 1332 KB Output is correct
37 Correct 15 ms 1848 KB Output is correct
38 Correct 21 ms 1840 KB Output is correct
39 Correct 11 ms 1828 KB Output is correct
40 Correct 12 ms 1836 KB Output is correct
41 Correct 13 ms 1872 KB Output is correct
42 Correct 21 ms 1840 KB Output is correct
43 Correct 1276 ms 1832 KB Output is correct
44 Correct 102 ms 1832 KB Output is correct
45 Correct 13 ms 1736 KB Output is correct
46 Correct 21 ms 1840 KB Output is correct
47 Correct 21 ms 1744 KB Output is correct
48 Correct 11 ms 1848 KB Output is correct
49 Correct 19 ms 1844 KB Output is correct
50 Correct 245 ms 1836 KB Output is correct
51 Correct 764 ms 1828 KB Output is correct
52 Correct 22 ms 1864 KB Output is correct
53 Correct 14 ms 1872 KB Output is correct
54 Correct 14 ms 1852 KB Output is correct
55 Execution timed out 4038 ms 1832 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4054 ms 1196 KB Time limit exceeded
2 Halted 0 ms 0 KB -