Submission #1056450

# Submission time Handle Problem Language Result Execution time Memory
1056450 2024-08-13T09:28:49 Z epicci23 Radio Towers (IOI22_towers) C++17
0 / 100
367 ms 2512 KB
#include "bits/stdc++.h"
#include "towers.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;

bool ok=1;
vector<int> xd;

void init(int n, vector<int> ar) {
  if(n<=2) {ok=0;return;}
  vector<array<int,2>> v;
  vector<int> xd;
  if(ar[1]>ar[2]) v.push_back({ar[1],0});
  else {xd.push_back(1);v.push_back({ar[1],1});}
  for(int i=2;i<n;i++){
  	if(ar[i]>ar[i-1] && ar[i]>ar[i+1]) v.push_back({ar[i],0});
  	else if(ar[i]<ar[i-1] && ar[i]<ar[i+1]) {xd.push_back(i);v.push_back({ar[i],1});}
  }
  if(ar[n]<ar[n-1]) {xd.push_back(n);v.push_back({ar[n],1});}
  else v.push_back({ar[n],0});
}

int max_towers(int l, int r, int D){
  if(!ok) return 0;
  int it=upper_bound(all(xd),r)-xd.begin();
  int it2=lower_bound(all(xd),l)-xd.begin();
  return it-it2; 
}



/*void _(){
  int n,q;cin >> n >> q;
  int ar[n+5];
  for(int i=1;i<=n;i++) cin >> ar[i];
  
  if(n<=2) return;

  vector<array<int,2>> v;
  vector<int> xd;
  if(ar[1]>ar[2]) v.push_back({ar[1],0});
  else {xd.push_back(1);v.push_back({ar[1],1});}
  for(int i=2;i<n;i++){
  	if(ar[i]>ar[i-1] && ar[i]>ar[i+1]) v.push_back({ar[i],0});
  	else if(ar[i]<ar[i-1] && ar[i]<ar[i+1]) {xd.push_back(i);v.push_back({ar[i],1});}
  }
  if(ar[n]<ar[n-1]) {xd.push_back(n);v.push_back({ar[n],1});}
  else v.push_back({ar[n],0});


  while(q--){
  	int l,r,d;
  	cin >> l >> r >> d;
  	int it=upper_bound(all(xd),r)-xd.begin();
  	int it2=lower_bound(all(xd),l)-xd.begin();
  	cout << it-it2 << '\n'; 
  }
}

int32_t main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int tc=1;//cin >> tc;
  while(tc--) _();
  return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 213 ms 856 KB 1st lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 508 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 508 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 367 ms 2512 KB 1st lines differ - on the 1st token, expected: '11903', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 131 ms 856 KB 1st lines differ - on the 1st token, expected: '7197', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 508 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 213 ms 856 KB 1st lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -