Submission #897405

# Submission time Handle Problem Language Result Execution time Memory
897405 2024-01-03T04:03:23 Z Iwantbemaster XOR Sum (info1cup17_xorsum) C++17
7 / 100
108 ms 131072 KB
    #include <bits/stdc++.h>
    #include <functional>
    using namespace std;
    #define int long long
    #define ff first
    #define ss second
    main(){
        int n; cin >> n;
        vector<int> v(n);
        for(int i = 0; i < n; i++){
            cin >> v[i];
        }
        vector<int> res;
        for(int i = 0; i < n; i++){
            int sum = v[i];
            for(int j = i; j < n; j++){
                sum += v[j];
                res.push_back(sum);
                sum = v[i];
            }
        }
        int cur = res[0];
        for(int i = 1; i < res.size(); i++){
            cur = cur ^ res[i];
        }
        cout << cur;
    }
    const int fastIO = [](){
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr); cout.tie(nullptr);
        return 0;
    }();

Compilation message

xorsum.cpp:7:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 |     main(){
      |     ^~~~
xorsum.cpp: In function 'int main()':
xorsum.cpp:23:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for(int i = 1; i < res.size(); i++){
      |                        ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 45 ms 67264 KB Output is correct
2 Correct 34 ms 67520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 108 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 108 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 67264 KB Output is correct
2 Correct 34 ms 67520 KB Output is correct
3 Runtime error 53 ms 131072 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 67264 KB Output is correct
2 Correct 34 ms 67520 KB Output is correct
3 Runtime error 108 ms 131072 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -