제출 #553965

#제출 시각아이디문제언어결과실행 시간메모리
553965FidanXORanges (eJOI19_xoranges)C++17
20 / 100
522 ms11060 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll inf=(1e18); const ll N=1'000'010; void upd(ll id, ll val, vector<ll> &fen){ id++; while(id<=fen.size()){ fen[id]=(fen[id]^val); id+=id&(-id); } } ll que(ll id, vector<ll> &fen){ id++; ll s=0; while(id>0){ s=(s^fen[id]); id-=id&(-id); } return s; } int main(){ ll n, q, i; cin>>n>>q; vector<ll> v(n+1, 0); vector<ll> a1(n+1, 0); vector<ll> a2(n+1, 0); for(i=1; i<=n; i++){ cin>>v[i]; } for(i=1; i<=n; i++){ if(i%2==0) upd(i, v[i], a2); else upd(i, v[i], a1); } while(q--){ ll t; cin>>t; if(t==1){ ll a, b; cin>>a>>b; if(a%2==0){ upd(a, (v[a]^b), a2); } else{ upd(a, (v[a]^b), a1); } v[a]=b; } else { ll l, r; cin>>l>>r; if((r-l)%2==1) cout<<0<<endl; else { ll s=0; if(l%2==0) s=(que(r, a2)^que(l-1, a2)); else s=(que(r, a1)^que(l-1, a1)); cout<<s<<endl; } } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

xoranges.cpp: In function 'void upd(ll, ll, std::vector<long long int>&)':
xoranges.cpp:10:10: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  while(id<=fen.size()){
      |        ~~^~~~~~~~~~~~
#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...