Submission #230644

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2306442020-05-10 17:37:41DrSwadMechanical Doll (IOI18_doll)C++17
6 / 100
97 ms10800 KiB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int N = int(4e5) + 10;
int c[N];
int x[N], y[N];
int switches_used;
void handle(int from, int L, int R, vector<int> &a) {
if (R - L + 1 <= 0) return;
if (R - L + 1 == 1) {
c[from] = a[0];
return;
}
int at_switch = ++switches_used;
if (R - L + 1 == a.size()) c[from] = -at_switch;
int mid = (L + R) >> 1;
if (R - L + 1 > 2) {
vector<int> b(R - L + 1);
for (int i = L; i <= R; i++) {
if ((i - L) % 2 == 0) b[(i - L) / 2] = a[i];
else b[mid + (i - L + 1) / 2 - L] = a[i];
}
for (int i = L; i <= R; i++) a[i] = b[i - L];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

doll.cpp: In function 'void handle(int, int, int, std::vector<int>&)':
doll.cpp:20:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  if (R - L + 1 == a.size()) c[from] = -at_switch;
      |      ~~~~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...