Submission #796988

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7969882023-07-29 03:02:07ThMinh_Cake 3 (JOI19_cake3)C++14
100 / 100
825 ms206280 KiB
#include<bits/stdc++.h>
#define forin(i, a, b) for(int i = a; i <= b; ++i)
#define ll long long
using namespace std;
const int N = 2e5 + 10;
int n, m;
ll ans, inf = 2e18;
ll s[N];
struct it {
int cnt;
ll sum;
it* lf;
it* rt;
it() : cnt(), sum(), lf(), rt() { }
void build(int f = 1, int l = n) {
if(f == l) return;
int mid = f + l >> 1;
lf = new it();
rt = new it();
lf -> build(f, mid);
rt -> build(mid + 1, l);
}
void up(int i, ll val, int f = 1, int l = n) {
if(f == l) {
cnt = 1;
sum = val;
return;
}
int mid = f + l >> 1;
if(i <= mid) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cake3.cpp: In member function 'void it::build(int, int)':
cake3.cpp:17:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |         int mid = f + l >> 1;
      |                   ~~^~~
cake3.cpp: In member function 'void it::up(int, long long int, int, int)':
cake3.cpp:29:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   29 |         int mid = f + l >> 1;
      |                   ~~^~~
cake3.cpp: In function 'long long int get(it*, it*, int, int, int)':
cake3.cpp:51:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   51 |     int mid = f + l >> 1;
      |               ~~^~~
cake3.cpp: In function 'void solve(int, int, int, int)':
cake3.cpp:65:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   65 |     int mid = f + l >> 1, nxt = 0;
      |               ~~^~~
cake3.cpp: In function 'int main()':
cake3.cpp:83:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   83 |         freopen("Task.inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
cake3.cpp:84:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   84 |         freopen("WA.out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...