이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ff(i, a, b) for(auto i=(a); i<=(b); ++i)
#define ffr(i, b, a) for(auto i=(b); i>=(a); --i)
#define nl "\n"
#define ss " "
#define sz size()
#define pb emplace_back
#define pf push_front
#define fi first
#define se second
#define ms(a,x) memset(a, x, sizeof (a))
#define re exit(0)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
const ll mod=1e9+7, maxn=3e5+5, inf=1e18;
void rf(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
if(fopen("o.inp","r")){
freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
}
}
int n, q, a[maxn], f[5005][5005];
int main()
{
rf();
cin>>n>>q;
ff(i, 1, n) cin>>a[i];
ff(i, 1, n)
{
ff(j, i, n)
{
cout<<i<<ss<<j<<ss;
ff(k, i, j) f[i][j]^=a[k];
cout<<f[i][j]<<nl;
}
}
re;
while(q--)
{
int op, l, r; cin>>op>>l>>r;
if(op==1) a[l]=r;
else
{
if(n<=100)
{
int ans=0;
ff(i, l, r) ff(j, i, r) ff(k, i, j) ans^=a[k];
cout<<ans<<nl;
}
else if(n<=500)
{
int ans=0;
ff(i, l, r) ff(j, i, r) ans^=f[i][j];
cout<<ans<<nl;
}
}
}
re;
}
컴파일 시 표준 에러 (stderr) 메시지
xoranges.cpp: In function 'void rf()':
xoranges.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
xoranges.cpp:32:44: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |