Submission #120700

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1207002019-06-25 09:12:36onjo0127Cake 3 (JOI19_cake3)C++11
100 / 100
1117 ms156464 KiB
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
struct Node {
int c; long long s;
int lc, rc;
};
const long long INF = 1LL * 1e18;
const Node emp = {0, 0, -1, -1};
struct PST {
vector<int> root;
vector<Node> T;
void init(int idx, int s, int e) {
T[idx] = emp;
if(s == e) return;
T[idx].lc = idx*2;
T[idx].rc = idx*2+1;
int m = s+e >> 1;
init(idx*2, s, m);
init(idx*2+1, m+1, e);
}
long long get(int pid, int nid, int s, int e, int k) {
//printf("pseg get: pid: %d, nid: %d, s: %d, e: %d, k: %d\n", pid, nid, s, e, k);
int cnt = T[nid].c - T[pid].c;
if(cnt == k) return T[nid].s - T[pid].s;
if(cnt < k) return -INF;
int plc = T[pid].lc, nlc = T[nid].lc, prc = T[pid].rc, nrc = T[nid].rc, m = s+e >> 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cake3.cpp: In member function 'void PST::init(int, int, int)':
cake3.cpp:21:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m = s+e >> 1;
           ~^~
cake3.cpp: In member function 'long long int PST::get(int, int, int, int, int)':
cake3.cpp:30:80: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int plc = T[pid].lc, nlc = T[nid].lc, prc = T[pid].rc, nrc = T[nid].rc, m = s+e >> 1;
                                                                               ~^~
cake3.cpp: In member function 'void PST::upd(int, int, int, int, int, int)':
cake3.cpp:45:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m = s+e >> 1;
           ~^~
cake3.cpp: In function 'void dnc(int, int, int, int)':
cake3.cpp:82:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m = s+e >> 1;
          ~^~
cake3.cpp: In function 'int main()':
cake3.cpp:98:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&N,&M);
  ~~~~~^~~~~~~~~~~~~~
cake3.cpp:100:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&V[i],&C[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...