답안 #897407

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897407 2024-01-03T04:05:33 Z Iwantbemaster XOR Sum (info1cup17_xorsum) C++17
7 / 100
93 ms 131072 KB
    #include <bits/stdc++.h>
    #include <functional>
    using namespace std;
    #define int long long
    #define ff first
    #define ss second
    main(){
        unsigned long long n; cin >> n;
        vector<unsigned long long> v(n);
        for(unsigned long long i = 0; i < n; i++){
            cin >> v[i];
        }
        vector<unsigned long long> res;
        for(unsigned long long i = 0; i < n; i++){
            unsigned long long sum = v[i];
            for(unsigned long long j = i; j < n; j++){
                sum += v[j];
                res.push_back(sum);
                sum = v[i];
            }
        }
        unsigned long long cur = res[0];
        for(unsigned long long 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(){
      |     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 66240 KB Output is correct
2 Correct 38 ms 66484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 93 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 93 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 66240 KB Output is correct
2 Correct 38 ms 66484 KB Output is correct
3 Runtime error 51 ms 131072 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 66240 KB Output is correct
2 Correct 38 ms 66484 KB Output is correct
3 Runtime error 93 ms 131072 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -