Submission #626298

# Submission time Handle Problem Language Result Execution time Memory
626298 2022-08-11T11:09:40 Z sword060 Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 1444 KB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
int a[100005];
void init(int N,vector<int> H){
	for(int i=0;i<H.size();i++)a[i]=H[i];
}
int max_towers(int L, int R, int D){
	int ret=1;
	for(int i=L+1;i<R;i++){
		int c1=0,c2=0;
		for(int j=i-1;j>=L;j--){
			if(abs(a[i]-a[j])>D)break;
			c1++;
		}
		for(int j=i+1;j<=R;j++){
			if(abs(a[i]-a[j])>D)break;
			c2++;
		}
		ret=max(ret,c1+c2);
	}
	return ret;
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:6:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |  for(int i=0;i<H.size();i++)a[i]=H[i];
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 4065 ms 976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '3'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '3'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4022 ms 1444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4086 ms 524 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '3'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4065 ms 976 KB Time limit exceeded
2 Halted 0 ms 0 KB -