제출 #1146496

#제출 시각아이디문제언어결과실행 시간메모리
1146496Bilal_CoderXOR Sum (info1cup17_xorsum)C++20
45 / 100
464 ms16480 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 ssolve(vec<int> a , int mx){ int n = sz(a) , mn = inf; unordered_map<int , int> mp; for (auto x : a) mp[x]++ , mn = min(mn , x); int ans = 0; for (int i = mn; i <= mx << 1; i++){ for (int j = 0; j <= mx; j++){ int c = mp[i - j]; while(c--) ans ^= i; } } cout << ans << "\n"; exit(0); } void solve() { // Code here int n; see(n); vec<int> a; int mx = -inf; for (int i = 0; i < n; i++){ int x;see(x); mx = max(mx , x) , a.push_back(x); } if (mx <= 4000) ssolve(a , mx); int ans = 0; for (int i = 0; i < n; i++){ for (int j = i; j < n; j++) ans ^= (a[i] + a[j]); } cout << ans << "\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...