# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
605908 | 2022-07-26T04:21:01 Z | kawaii | Secret (JOI14_secret) | C++14 | 472 ms | 8792 KB |
#include "secret.h" #include<bits/stdc++.h> using namespace std; int a[1005], pre[1005][1005]; map<pair<int, int>, int> mp; void Init(int N, int A[]){ for(int i = 1; i <= N; i++) a[i] = A[i - 1]; for(int i = 1; i <= N; i++) pre[i][i] = a[i]; for(int i = 1; i <= 9; i++){ for(int j = 1; j + (1 << i) - 1 <= N; j++){ int val = Secret(pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]); pre[j][j + (1 << i) - 1] = val; mp[{pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]}] = val; } } } int Query(int L, int R){ int ans = -1; L++; R++; int diff = R - L + 1; // cout << diff <<" "; for(int i = 0; i <= 9; i++){ if((1 << i) & diff){ if(ans == -1) ans = pre[L][L + (1 << i) - 1]; else{ if(mp[{ans, pre[L][L + (1 << i) - 1]}] == 0){ int val = Secret(ans, pre[L][L + (1 << i) - 1]); mp[{ans, pre[L][L + (1 << i) - 1]}] = val; ans = val; } } L += (1 << i); } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 120 ms | 4628 KB | Wrong Answer: Query(24, 364) - expected : 538313475, actual : 592522065. |
2 | Incorrect | 148 ms | 4612 KB | Wrong Answer: Query(127, 409) - expected : 507643944, actual : 889956480. |
3 | Incorrect | 148 ms | 4668 KB | Wrong Answer: Query(286, 376) - expected : 755464542, actual : 615663878. |
4 | Incorrect | 472 ms | 8704 KB | Wrong Answer: Query(548, 909) - expected : 117457562, actual : 813318716. |
5 | Incorrect | 467 ms | 8708 KB | Wrong Answer: Query(12, 242) - expected : 776522766, actual : 941655040. |
6 | Incorrect | 465 ms | 8648 KB | Wrong Answer: Query(319, 321) - expected : 727935331, actual : 256206461. |
7 | Incorrect | 458 ms | 8716 KB | Wrong Answer: Query(16, 922) - expected : 799683707, actual : 52037739. |
8 | Incorrect | 450 ms | 8736 KB | Wrong Answer: Query(23, 956) - expected : 880892032, actual : 140680. |
9 | Incorrect | 437 ms | 8792 KB | Wrong Answer: Query(24, 950) - expected : 671229290, actual : 809511918. |
10 | Incorrect | 452 ms | 8712 KB | Wrong Answer: Query(35, 904) - expected : 270608459, actual : 605520960. |