제출 #1146386

#제출 시각아이디문제언어결과실행 시간메모리
1146386Bilal_CoderXOR Sum (info1cup17_xorsum)C++20
0 / 100
48 ms8620 KiB
#include <bits/stdc++.h>


using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")

using ll = long long;

template<typename... T>
void see(T&... args) { ((cin >> args), ...);}
#define seea(a , x , y) for(int i = x; i < y; i++){cin >> a[i];}
#define sees(s , n) for(int i = 0;i < n; i++){int x; cin >> x; s.insert(x);}
#define seev(v , n) for(int i = 0;i < n; i++){int x; cin >> x; v.push_back(x);}
#define ub(a, x) upper_bound(all(a), x)
#define lb(a, x) lower_bound(all(a), x)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define pii pair<int , int>
#define sz(x) (int)x.size()
#define pq priority_queue
#define vec vector
#define arr array
#define int ll
const ll inf = 1e18;
const int N = 2e5 + 5;

void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}

void solve() {
    // Code here
    int n;
    see(n);
    vec<int> a;
    seev(a , n);
    int ans = 0 , sum = 0;
    for (int i = 0; i < n; i++){
        sum += a[i];
        ans ^= sum;
    }
    cout << ans * n << "\n";
    return;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // setIO("");
        solve();
}

컴파일 시 표준 에러 (stderr) 메시지

xorsum.cpp: In function 'void setIO(std::string)':
xorsum.cpp:31:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xorsum.cpp:32:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...