Submission #839286

# Submission time Handle Problem Language Result Execution time Memory
839286 2023-08-29T15:03:18 Z epicci23 Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 304 KB
#include "bits/stdc++.h"
#include "plants.h"
using namespace std;
#define pb push_back
#define endl "\n" 
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

const int N = 200005;
int pre[N][2];
// 0 >
// 1 <
int n;
int query(int l,int r)
{
  l++;r++;
  int uz=r-l;
  if(pre[r-1][0]-pre[l-1][0]==uz) return -1;
  if(pre[r-1][1]-pre[l-1][1]==uz) return 1;
  
  int cur = pre[n][0] - pre[r-1][0] + pre[l-1][0];
  if(cur==n-r+l) return -1;
  cur = pre[n][1] - pre[r-1][1] + pre[l-1][1];
  if(cur==n-r+l) return 1;
  return 0;
}

void init(int k,vector<int> r) {
  n = sz(r);
    for(int i=1;i<=n;i++)
    {
      pre[i][0]+=pre[i-1][0];
      pre[i][1]+=pre[i-1][1];
      if(r[i-1]==0) pre[i][0]++;
      else pre[i][1]++;
    }
  return;
}

int compare_plants(int x, int y){
  return query(x,y);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -