QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#460355 | #5533. Trick | fryan | 0 | 7ms | 1640kb | C++20 | 1.2kb | 2024-07-01 14:24:56 | 2024-07-01 14:24:57 |
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
const int mxn = 2e6;
int t,r;
int n, m, su, cnt[mxn];
void solve() {
if (r<3) {
scanf("%lld",&n);
m = 2*n + 1; su = 0;
fill(cnt,cnt+m,0);
for (int i=0; i<n; i++) {
int a; scanf("%lld",&a);
cnt[a%m]++; su += a;
}
su %= m;
for (int i=0; i<m; i++) {
if (cnt[i] && cnt[(i-su+m)%m]) {
if (i == (i-su+m)%m) {
if (cnt[i] == 1) continue;
}
printf("%lld %lld\n",i,(i-su+m)%m);
return;
}
}
} else {
scanf("%lld",&n);
m = 2*n + 1;
int a,b,c,d; scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
int su = (a-b+c-d+m*10)%m;
printf("%lld\n",m-su);
}
}
signed main() {
scanf("%lld%lld",&t,&r);
while (t--) {
solve();
}
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 5ms = 0ms + 5ms
memory: 0kb,1640kb
input:
12012 1 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 ...
output:
2 0 2 0 2 0 2 0 2 0 2 0 2 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 0 5 0 5 0 5 0 5 0 5 0 5 0 6 0 6 0 6 0 6 0 6 0 6 0 6 0 0 6 0 6 0 6 0 6 0 6 0 6 0 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 4 0 4 0 4 0 4 0 4 0 4 0 4 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 0 7 0 7 0 7 0 7 0 7 0 7 0 7 1 7 1 7 1 7 1 7 1 7 ...
input:
12012 2 6 7 8 9 10 11 12 6 6 8 9 10 11 12 6 6 7 9 10 11 12 6 6 7 8 10 11 12 6 6 7 8 9 11 12 6 6 7 8 9 10 12 6 6 7 8 9 10 11 6 7 8 9 10 11 12 6 5 8 9 10 11 12 6 5 7 9 10 11 12 6 5 7 8 10 11 12 6 5 7 8 9 11 12 6 5 7 8 9 10 12 6 5 7 8 9 10 11 6 7 8 9 10 11 12 6 4 8 9 10 11 12 6 4 7 9 10 11 12 6 4 7 8 1...
output:
12 7 10 6 9 6 8 6 7 6 6 7 12 7 8 5 7 5 8 7 7 8 5 7 12 7 10 8 10 9 7 8 7 9 4 7 12 7 9 8 7 8 7 9 7 10 3 7 12 7 9 10 8 10 8 11 8 12 2 7 12 7 8 9 7 9 7 10 7 11 7 12 1 7 12 7 8 10 7 10 7 11 7 12 7 0 0 7 10 6 8 5 6 5 5 6 6 8 5 8 10 6 10 8 10 11 4 6 6 9 4 8 10 6 9 8 9 10 6 8 3 6 6 10 3 8 10 6 9 11 8 11 2 6...
input:
12012 3 6 2 0 12 7 6 2 0 10 6 6 2 0 9 6 6 2 0 8 6 6 2 0 7 6 6 2 0 6 7 6 2 0 12 7 6 3 0 8 5 6 3 0 7 5 6 3 0 8 7 6 3 0 7 8 6 3 0 5 7 6 3 0 12 7 6 3 0 10 8 6 5 1 10 9 6 5 1 7 8 6 5 1 7 9 6 5 1 4 7 6 5 1 12 7 6 5 1 9 8 6 5 1 7 8 6 5 0 7 9 6 5 0 7 10 6 5 0 3 7 6 5 0 12 7 6 5 0 9 10 6 5 0 8 10 6 5 0 8 11 ...
output:
6 7 8 9 10 12 6 7 8 9 11 12 5 8 8 10 11 12 4 8 10 10 11 12 3 9 10 11 11 12 2 8 9 10 11 11 12 1 8 9 10 11 11 12 1 2 4 6 7 12 5 7 10 11 12 13 4 7 9 10 11 12 13 3 9 10 11 12 13 3 7 9 10 11 12 13 2 7 9 10 11 12 13 2 2 5 6 7 8 9 1 6 9 10 11 12 13 4 9 10 12 13 3 7 10 10 11 12 13 2 7 10 10 11 12 13 2 3 7 7...
result:
wrong answer the card you returned is 12, but expected 11 (test case 6)
Subtask #2:
score: 0
Skipped
Subtask #3:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 7ms = 0ms + 7ms
memory: 0kb,1600kb
input:
6525 1 6 10 1 11 3 12 6 6 1 7 10 12 5 6 6 0 10 12 7 9 8 6 12 1 8 4 7 11 6 11 8 9 4 10 6 6 0 7 2 3 4 5 6 0 8 3 10 11 6 6 0 1 2 4 7 6 6 0 1 11 9 5 6 6 7 1 12 8 6 5 7 0 1 13 10 12 5 6 7 0 14 2 3 4 12 6 7 11 1 3 8 12 6 13 7 0 1 2 3 13 5 14 7 11 9 10 8 4 14 7 7 0 8 14 3 4 13 11 7 0 10 2 14 8 5 6 7 0 13 2...
output:
1 10 1 12 7 0 8 4 4 8 0 5 10 11 0 6 6 0 0 13 0 4 6 12 13 5 7 4 4 11 0 13 2 1 5 1 5 8 1 16 1 3 0 12 0 2 2 15 8 1 6 9 6 2 3 4 2 11 5 14 5 14 5 3 5 15 0 2 12 16 0 12 2 11 0 3 12 13 4 5 3 5 0 16 2 1 4 13 1 13 3 15 0 2 5 22 1 18 0 4 0 14 2 14 9 4 5 8 2 22 4 18 0 15 5 21 15 19 1 20 5 22 1 13 3 8 0 4 3 12 ...
input:
6525 2 6 0 2 4 5 8 9 6 2 3 4 8 9 11 6 1 2 3 4 5 11 6 0 3 5 6 9 10 6 0 1 3 5 7 12 6 1 6 8 10 11 12 6 2 4 5 7 9 12 6 5 8 9 10 11 12 6 3 4 7 8 10 12 6 0 2 3 4 9 11 7 2 3 4 7 8 9 11 7 1 5 7 8 9 10 13 7 0 4 5 7 9 10 14 7 4 6 7 8 9 10 11 7 0 1 2 3 5 6 13 7 1 2 5 7 9 10 12 7 1 3 4 9 11 12 13 7 1 3 4 6 10 1...
output:
2 0 2 4 0 6 1 12 6 10 8 5 4 12 3 0 2 3 1 8 4 0 4 9 2 1 4 11 4 14 4 5 3 7 0 4 0 10 5 2 1 14 4 1 7 10 4 11 1 14 7 0 5 3 0 1 2 7 4 5 0 2 1 17 0 18 2 12 8 11 1 5 6 4 0 16 7 20 0 10 3 17 0 10 3 17 18 12 2 3 9 11 1 18 2 1 1 15 1 11 2 11 7 5 2 15 6 7 10 16 0 9 0 18 3 11 1 21 1 8 0 2 2 18 7 1 0 9 0 13 1 18 ...
input:
6525 3 6 1 10 2 0 6 1 12 2 4 6 7 0 0 6 6 8 4 1 12 6 4 8 6 10 6 0 5 8 5 6 10 11 4 12 6 0 6 3 0 6 6 0 2 3 6 0 13 1 8 7 0 4 4 0 7 6 12 4 9 7 13 5 2 1 7 7 4 4 11 7 4 11 4 14 7 0 13 4 5 7 2 1 3 7 7 5 1 0 4 7 5 8 0 10 7 1 16 5 2 8 1 3 1 14 8 0 12 4 1 8 0 2 7 10 8 2 15 4 11 8 8 1 1 14 8 6 9 7 0 8 6 2 5 3 8...
output:
7 13 12 7 8 2 9 3 8 7 15 11 6 4 2 14 3 15 13 12 15 9 5 3 6 13 11 2 14 10 11 14 9 12 7 16 7 19 14 11 16 5 13 3 13 14 19 16 10 14 23 10 8 4 3 23 10 1 1 3 19 5 22 13 22 8 23 21 4 16 7 21 5 18 8 13 9 1 21 15 5 22 8 6 21 16 8 17 22 2 10 14 22 20 7 5 15 13 12 10 1 17 18 16 14 3 14 17 3 16 22 12 16 21 23 8...
result:
wrong answer the card you returned is 13, but expected 0 (test case 2)
Subtask #4:
score: 0
Skipped