답안 #496727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496727 2021-12-22T03:31:36 Z Ziel XOR Sum (info1cup17_xorsum) C++17
7 / 100
1600 ms 4172 KB
/**
 * LES GREATEABLES BRO TEAM
**/

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define sz(x) (int)x.size()
const bool FLAG = false;
void setIO(const string &f = "");

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &x: a)
    	cin >> x;
    int res = 0;
	for (int i = 0; i < n; i++)
		for (int j = i; j < n; j++)
			res ^= (a[i] + a[j]);
	cout << res;
}

signed main() {
    setIO();
    
    int tt = 1;
    if (FLAG) {
    	cin >> tt;
    }
    while (tt--) {
    	solve();
    }
    
    return 0;
}

void setIO(const string &f) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    if (fopen((f + ".in").c_str(), "r")) {
        freopen((f + ".in").c_str(), "r", stdin);
        freopen((f + ".out").c_str(), "w", stdout);
    }
}

Compilation message

xorsum.cpp: In function 'void setIO(const string&)':
xorsum.cpp:45:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |         freopen((f + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xorsum.cpp:46:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |         freopen((f + ".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 328 KB Output is correct
2 Correct 7 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1685 ms 4172 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1685 ms 4172 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 328 KB Output is correct
2 Correct 7 ms 328 KB Output is correct
3 Execution timed out 1690 ms 716 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 328 KB Output is correct
2 Correct 7 ms 328 KB Output is correct
3 Execution timed out 1685 ms 4172 KB Time limit exceeded
4 Halted 0 ms 0 KB -