Submission #966240

# Submission time Handle Problem Language Result Execution time Memory
966240 2024-04-19T14:57:35 Z vjudge1 XORanges (eJOI19_xoranges) C++17
0 / 100
66 ms 7408 KB
#include <bits/stdc++.h>
using namespace std;

#define fii(i,a,b)      for(int i = a; i <= b; i++)
#define fid(i,a,b)      for(int i = a; i >= b; i--)
#define ll              long long
#define fi              first
#define se              second
#define pii             pair< int, int >
#define pll             pair< long long , long long >
#define sz(x)           int(x.size())
#define faster 	        ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); 
#define maxn            1000005 
#define all(a)          a.begin(), a.end()
#define ins             insert
#define pb              push_back
#define Base            13
// #define int             long long
#define MOD             1000000007
#define endl            '\n'
#define fill(a,n)       memset(a, n, sizeof(a));
#define re              return
#define name            "file"
ll a[maxn];

int main(){
    
    if(fopen(name".INP","r")){
        freopen(name".INP", "r", stdin);
        freopen(name".OUT", "w", stdout);
    }
    faster
    int n, q;
    cin >> n >> q;
    fii(i, 1, n)
    {
        cin >> a[i];
    }
    fii(i, 1, q)
    {
        int t, l, u;
        cin >> t >> l >> u;
        if(t == 1)
        {
            a[l] = u;
        }
        else
        {
            if(u - l + 1 == 1)
            {
                cout << a[l] << endl;
            } 
            else if(u - l + 1 == 2)
            {
                cout << 0 << endl;
            }
            else if(u - l + 1 == 3)
            {
                ll c = a[l] ^ a[u];
                cout << c << '\n';
            }
            else
            {  
                ll c = a[l] ^ a[l + 1];
                ll d = a[u] ^ a[u - 1];
                ll ans = c ^ d;
                cout << ans << endl;
            }
        }
    }
}

Compilation message

xoranges.cpp: In function 'int main()':
xoranges.cpp:29:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         freopen(name".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:30:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |         freopen(name".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 7408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -