Submission #791559

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7915592023-07-24 07:24:19WongChun1234Digital Circuit (IOI22_circuit)C++17
100 / 100
925 ms40048 KiB
#include "circuit.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200050;
const ll MOD=1000002022;
int n,m,lz[N<<2];
ll dp[N],rdp[N],seg[N<<2],iseg[N<<2];
vector<int> p,a;
vector<ll> ch[N],pref[N],suff[N];
void build(int id,int l,int r){
if (l==r){
seg[id]=a[l-1]*rdp[l+n-1];
iseg[id]=(!a[l-1])*rdp[l+n-1];
//cout<<id<<" "<<l<<" "<<r<<" "<<seg[id]<<" "<<iseg[id]<<"\n";
return;
}
int m=(l+r)/2;
build(id*2,l,m);
build(id*2+1,m+1,r);
seg[id]=(seg[id*2]+seg[id*2+1])%MOD;
iseg[id]=(iseg[id*2]+iseg[id*2+1])%MOD;
//cout<<id<<" "<<l<<" "<<r<<" "<<seg[id]<<" "<<iseg[id]<<"\n";
}
void pushdown(int id){
lz[id]^=1;
swap(seg[id],iseg[id]);
}
void update(int id,int l,int r,int ql,int qr){
if (l>=ql&&r<=qr){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

circuit.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>)':
circuit.cpp:56:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |   for (int j=1;j<=ch[i].size();j++) pref[i][j]=pref[i][j-1]*pref[i][j]%MOD;
      |                ~^~~~~~~~~~~~~~
circuit.cpp:62:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |   for (int j=1;j<=ch[i].size();j++) rdp[ch[i][j-1]]=rdp[i]*(pref[i][j-1]*suff[i][j+1]%MOD)%MOD;
      |                ~^~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...