QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#514915 | #2264. Secrets of Legendary Treasure | IllusionaryDominance# | WA | 1ms | 3840kb | C++20 | 1.2kb | 2024-08-11 13:26:59 | 2024-08-11 13:27:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int dp[110][110];
pair<int, int> from[110][110];
int gp[210], pos[210];
int ansa[110], ansb[110];
int main(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n, m; cin >> n >> m;
for (int i = 1; i <= n; ++ i){
int x; cin >> x;
if(x){
gp[x] = 1;
pos[x] = i;
}
}
for (int i = 1; i <= m; ++ i){
int x; cin >> x;
if(x){
gp[x] = 2;
pos[x] = i;
}
}
dp[0][0] = 1;
for (int i = 1; i <= n + m; ++ i){
for (int x = 0; x <= i; ++ x){
int y = i - x;
if(x > n || y > m) continue;
if(gp[i] == 1 && x != pos[i]) continue;
if(gp[i] == 2 && y != pos[i]) continue;
if(x != 0 && dp[x - 1][y]) dp[x][y] = 1, from[x][y] = {x - 1, y};
if(y != 0 && dp[x][y - 1]) dp[x][y] = 1, from[x][y] = {x, y - 1};
}
}
int x = n, y = m;
while(x + y){
if(from[x][y].first == x) ansb[y] = x + y, -- y;
else ansa[x] = x + y, -- x;
}
for (int i = 1; i <= n; ++ i) cout << ansa[i] << " "; cout << "\n";
for (int i = 1; i <= m; ++ i) cout << ansb[i] << " ";
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3840kb
input:
100 100 1 2 3 4 6 10 11 14 17 18 19 21 24 25 26 27 29 32 34 35 36 37 39 40 44 49 52 53 55 59 65 66 67 68 73 74 81 82 83 85 86 88 89 90 96 98 99 102 103 104 106 107 108 116 117 118 121 124 127 128 129 130 131 132 134 137 138 139 141 145 148 149 152 153 154 156 157 158 161 162 163 167 169 170 173 174 ...
output:
1 2 3 4 6 10 11 14 17 18 19 21 24 25 26 27 29 32 34 35 36 37 39 40 44 49 52 53 55 59 65 66 67 68 73 74 81 82 83 85 86 88 89 90 96 98 99 102 103 104 106 107 108 116 117 118 121 124 127 128 129 130 131 132 134 137 138 139 141 145 148 149 152 153 154 156 157 158 161 162 163 167 169 170 173 174 175 177 ...
result:
ok correct
Test #2:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
99 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 37
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 37
result:
ok correct
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3676kb
input:
90 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 92 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102...
result:
wrong answer invalid plan