Submission #768875

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7688752023-06-28 19:49:54keta_tsimakuridzeJousting tournament (IOI12_tournament)C++14
100 / 100
146 ms15344 KiB
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define f first
#define s second
const int N = 2e5 + 5;
int n;
int lz[4 * N], t[4 * N], fw[N];
void upd(int u, int id, int l, int r) {
if(l > id || r < id) return;
if(l == r) {
t[u] ^= 1;
return;
}
int mid = (l + r) / 2;
upd(2 * u, id, l, mid); upd(2 * u + 1, id, mid + 1, r);
t[u] = t[2 * u] + t[2 * u + 1];
}
int get(int u, int l, int r, int id) {
if(l == r) return l;
int mid = (l + r) / 2;
if(t[2 * u] >= id) return get(2 * u, l, mid, id);
return get(2 * u + 1, mid + 1, r, id - t[2 * u]);
}
void upd(int id, int v) {
++id;
for(id; id <= n; id += id & (-id)) fw[id] += v;
}
int get(int id) {
int ans = 0; ++id;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

tournament.cpp: In function 'void upd(int, int)':
tournament.cpp:27:9: warning: statement has no effect [-Wunused-value]
   27 |     for(id; id <= n; id += id & (-id)) fw[id] += v;
      |         ^~
tournament.cpp: In function 'int get(int)':
tournament.cpp:31:9: warning: statement has no effect [-Wunused-value]
   31 |     for(id; id >= 1; id -= id & (-id)) ans += fw[id];
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...