Submission #314394

# Submission time Handle Problem Language Result Execution time Memory
314394 2020-10-19T19:13:11 Z urosk XORanges (eJOI19_xoranges) C++14
55 / 100
21 ms 1784 KB
#include <bits/stdc++.h>
#include <chrono>
#define ll long long
#define ull unsigned long long
#define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inf 1e15
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
using namespace std;
using namespace std::chrono;
const int maxn = 1e5+1;
int a[maxn];
int main(){
	int n,q;
	scanf("%d %d",&n,&q);
	for(int i = 0;i<n;i++){
        scanf("%d",&a[i]);
	}
	int qu;
	int l,u;
	int ans;
	while(q--){
        cin >> qu>> l >> u;
        if(qu==1){
            a[l-1]=u;
        }else{
            ans = 0;
            if((u-l+1)%2==0){
                printf("0\n");
            }else{
                for(int i = l-1;i<=u-1;i+=2){
                    ans^=a[i];
                }
                printf("%lld\n",ans);
            }
        }
	}
}

Compilation message

xoranges.cpp:5:9: warning: ISO C++11 requires whitespace after the macro name
    5 | #define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |         ^~~~~~~~
xoranges.cpp: In function 'int main()':
xoranges.cpp:36:28: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int' [-Wformat=]
   36 |                 printf("%lld\n",ans);
      |                         ~~~^    ~~~
      |                            |    |
      |                            |    int
      |                            long long int
      |                         %d
xoranges.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |  scanf("%d %d",&n,&q);
      |  ~~~~~^~~~~~~~~~~~~~~
xoranges.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |         scanf("%d",&a[i]);
      |         ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 372 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 15 ms 512 KB Output is correct
12 Correct 15 ms 544 KB Output is correct
13 Correct 21 ms 512 KB Output is correct
14 Correct 21 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 20 ms 1784 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 372 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 15 ms 512 KB Output is correct
12 Correct 15 ms 544 KB Output is correct
13 Correct 21 ms 512 KB Output is correct
14 Correct 21 ms 512 KB Output is correct
15 Execution timed out 20 ms 1784 KB Time limit exceeded (wall clock)
16 Halted 0 ms 0 KB -