제출 #466707

#제출 시각아이디문제언어결과실행 시간메모리
466707mtxasXORanges (eJOI19_xoranges)C++14
12 / 100
8 ms460 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define fi first #define se second #define pll pair<ll, ll> #define mii map<int, int> #define vi vector<int> #define vll vector<ll> #define pb push_back #define all(a) a.begin(), a.end() #define sz(x) ((int)x.size()) #define turbo() cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false) #define _fre() freopen("input.txt", "r", stdin) #define _for(a, b, c) for(int (a) = (b); (a) < (c); (a)++) #define _foreq(a, b, c) for(int (a) = (b); (a) <= (c); (a)++) #define _forneq(a, b, c) for(int (a) = (b); (a) >= (c); (a)--) #define _forn(a, b, c) for(int (a) = (b); (a) > (c); (a)--) using namespace std; /********************************************************************************** STRUCTS **********************************************************************************/ /********************************************************************************** VARIABLES **********************************************************************************/ const int maxn = 101; int a[maxn]; int t[maxn<<1]; /********************************************************************************** FUNCTIONS **********************************************************************************/ /********************************************************************************** MAIN **********************************************************************************/ int main(){ // _fre(); turbo(); int n, q; cin>>n>>q; _foreq(i, 1, n) cin>>a[i]; _for(g, 0, q){ int type; cin>>type; if(type == 1){ int i, val; cin>>i>>val; a[i] = val; //cout<<"a["<<i<<"] = "<<val<<endl; } else if(type == 2){ int l, r; cin>>l>>r; // cout<<"query("<<l<<", "<<r<<")\n"; int reply = 0; _foreq(len, 1, r-l+1){ _foreq(startId, l, r-len+1){ int toXor = 0; //cout<<"range("<<startId<<", "<<startId+len-1<<")\n"; _foreq(i, startId, startId+len-1){ toXor ^= a[i]; } reply ^= toXor; } } cout<<reply<<'\n'; } } }

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

xoranges.cpp: In function 'int main()':
xoranges.cpp:17:33: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   17 | #define _foreq(a, b, c) for(int (a) = (b); (a) <= (c); (a)++)
      |                                 ^
xoranges.cpp:42:5: note: in expansion of macro '_foreq'
   42 |     _foreq(i, 1, n) cin>>a[i];
      |     ^~~~~~
xoranges.cpp:16:31: warning: unnecessary parentheses in declaration of 'g' [-Wparentheses]
   16 | #define _for(a, b, c) for(int (a) = (b); (a) < (c); (a)++)
      |                               ^
xoranges.cpp:43:5: note: in expansion of macro '_for'
   43 |     _for(g, 0, q){
      |     ^~~~
xoranges.cpp:17:33: warning: unnecessary parentheses in declaration of 'len' [-Wparentheses]
   17 | #define _foreq(a, b, c) for(int (a) = (b); (a) <= (c); (a)++)
      |                                 ^
xoranges.cpp:54:13: note: in expansion of macro '_foreq'
   54 |             _foreq(len, 1, r-l+1){
      |             ^~~~~~
xoranges.cpp:17:33: warning: unnecessary parentheses in declaration of 'startId' [-Wparentheses]
   17 | #define _foreq(a, b, c) for(int (a) = (b); (a) <= (c); (a)++)
      |                                 ^
xoranges.cpp:55:17: note: in expansion of macro '_foreq'
   55 |                 _foreq(startId, l, r-len+1){
      |                 ^~~~~~
xoranges.cpp:17:33: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   17 | #define _foreq(a, b, c) for(int (a) = (b); (a) <= (c); (a)++)
      |                                 ^
xoranges.cpp:58:21: note: in expansion of macro '_foreq'
   58 |                     _foreq(i, startId, startId+len-1){
      |                     ^~~~~~
#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...