Submission #844540

#TimeUsernameProblemLanguageResultExecution timeMemory
844540vjudge1Klasika (COCI20_klasika)C++17
0 / 110
12 ms19544 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; #define int long long const int MAXN = 2e5 + 5; #ifndef ONLINE_JUDGE #define OPEN freopen(".in", "r", stdin); \ freopen(".out", "w", stdout); #else #define OPEN void(23); #endif vector <pair <int, int>> adj[MAXN]; vector <pair <int, int>> radj[MAXN]; int cnt = 2; int FindAns(int a, int b) { vector <bool> sub(cnt + 5); function <void(int)> dfsSub = [&](int node) -> void { //cerr << node << " "; sub[node] = true; for(auto &[child, w] : adj[node]) dfsSub(child); return; }; dfsSub(b); int ans = 0; function <void(int, int, int)> dfs = [&](int node, int par, int sum) -> void { if(sub[node]) ans = max(ans, sum); for(auto &[child, w] : adj[node]) if(child != par) dfs(child, node, sum ^ w); for(auto &[child, w] : radj[node]) if(child != par) dfs(child, node, sum ^ w); }; dfs(a, 0, 0); return ans; } void solve() { int q; cin >> q; for(int i = 1; i <= q; i++) { string str; int a, b; cin >> str >> a >> b; if(str[0] == 'A') { adj[a].emplace_back(cnt, b); radj[cnt].emplace_back(a, b); cnt++; } else { cout << FindAns(a, b) << "\n"; } } return; } int32_t main() { OPEN; ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; while(t--) { solve(); } }

Compilation message (stderr)

klasika.cpp: In function 'int32_t main()':
klasika.cpp:10:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     #define OPEN freopen(".in", "r", stdin); \
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~
klasika.cpp:75:5: note: in expansion of macro 'OPEN'
   75 |     OPEN;
      |     ^~~~
klasika.cpp:11:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |                  freopen(".out", "w", stdout);
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
klasika.cpp:75:5: note: in expansion of macro 'OPEN'
   75 |     OPEN;
      |     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...