Submission #1073155

# Submission time Handle Problem Language Result Execution time Memory
1073155 2024-08-24T09:53:31 Z NeroZein A Light Inconvenience (CEOI23_light) C++17
0 / 100
0 ms 512 KB
#include "light.h"
#include <bits/stdc++.h>

using namespace std;

long long tot;
vector<long long> vec;

void prepare(){
  tot = 1;
  vec.push_back(1); 
}

pair<long long, vector<long long>> join(long long p){
  tot += p;
	for (int i = 0; i < (int) vec.size(); ++i) {
    vec[i] += p; 
  }
  vector<long long> new_vec; 
  for (long long x = 1; x <= tot; ) {
    new_vec.push_back(x); 
    if (x == tot) {
      break;
    }
    auto next_one = upper_bound(vec.begin(), vec.end(), 2 * x) - vec.begin();
    if (next_one != (int) vec.size() && vec[next_one] - p <= x * 2) {
      x = x * 2; 
    } else {
      x = vec[next_one - 1]; 
    }
  }
  vec = new_vec;
  return {p, vec};
}

pair<long long, vector<long long>> leave(long long p){
  tot -= p;
  for (int i = 0; i < (int) vec.size(); ++i) {
    vec[i] -= p; 
  }
  vector<long long> new_vec; 
  for (long long x = 1; x <= tot; ) {
    new_vec.push_back(x); 
    if (x == tot) {
      break;
    }
    auto next_one = upper_bound(vec.begin(), vec.end(), 2 * x) - vec.begin();
    if (next_one != (int) vec.size() && vec[next_one] - p <= x * 2) {
      x = x * 2; 
    } else {
      x = vec[next_one - 1]; 
    }
  }
  vec = new_vec;
  return {p, vec};
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB Correct
2 Incorrect 0 ms 340 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 428 KB Not correct
3 Halted 0 ms 0 KB -