# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
815857 | 2023-08-09T01:25:12 Z | yeyso | Minerals (JOI19_minerals) | C++14 | 2 ms | 336 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; void Solve(int N) { int a = 0; int b = 0; //vector<vector<int>> res(2 * N + 1, vector<int>(15, 0)); vector<int> res(2 * N + 1, 1); for(int k = 1; k <= 14; k ++){ for(int i = 1; i <= 2 * N; i ++){ if(i & (1 << k) and not i & (1 << (k - 1))){ a = Query(i); } if(not i & (1 << k) and i & (1 << (k - 1))){ a = Query(i); } } for(int i = 1; i <= 2 * N; i ++){ b = Query(i); if(a == b){ // Then b is paired with something where the kth bit is 1 //res[a][k] = 1; res[i] += (1 << k); } b = Query(i); } /*for(int i = 1; i <= 2 * N; i ++){ if(i & (1 << k)){ a = Query(i); } }*/ } /* N queries to set up 2N queries for each one N queries to remove Repeat all log(n) times = 4N * 15 */ set<pair<int, int>> ans; for(int i = 0; i < res.size(); i ++){ ans.insert({min(i , res[i] -1), max(i , res[i] - 1)}); //Answer(i, res[i]); } for(auto itx = ++ans.begin(); itx != ans.end(); ++itx){ Answer((*itx).first, (*itx).second); //cout << (*itx).first << " " << (*itx).second << "\n"; } } /* g++ -std=gnu++17 -O2 -Wall -pipe -static -o minerals grader.cpp minerals.cpp 4 1 5 2 6 3 4 7 8 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |