QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#435192 | #5261. Kolorowy wąż | Terryjoy | 0 | 0ms | 7684kb | C++14 | 1009b | 2024-06-08 19:14:48 | 2024-06-08 19:14:48 |
answer
#include <iostream>
using namespace std;
const int M = 2003, N = 1000006;
int m, p, n, w, k, mmp[M][M], x, y, val[N], tim = 1, len, t[M][M];
int read(){
int x = 0;
char a = getchar();
while(a < '0' || '9' < a) a = getchar();
while('0' <= a && a <= '9') x = (x << 1) + (x << 3) + (a ^ 48), a = getchar();
return x;
}
void write(int x){
if(x > 9) write(x / 10);
putchar(x % 10 | 48);
}
int main(){
for(int i = 1; i <= p; ++ i){
w = read(), k = read();
mmp[w][k] = read() + 1;
}
t[x = 1][y = 1] = 1, len = 1;
for(int i = 1; i <= n; ++ i){
char a = getchar();
while(a < 'A' || 'Z' < a) a = getchar();
if(a == 'Z'){
w = read(), k = read();
if(tim - t[w][k] >= len) fputs("-1\n", stdout);
else write(val[len - (tim - t[w][k])]), putchar('\n');
}
else{
if(a == 'G') x --;
else if(a == 'D') ++ x;
else if(a == 'L') y --;
else ++ y;
if(!t[x][y] && mmp[x][y]) val[++ len] = mmp[x][y] - 1;
t[x][y] = ++ tim;
}
}
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 7684kb
input:
2 3 2000 2 1 2 1 2 0 2 2 3 P D L Z 1 2 G Z 2 1 P Z 2 2 Z 2 1 D L Z 2 1 G P D Z 1 2 L G P D Z 2 2 L Z 2 2 Z 2 2 Z 2 1 Z 1 2 Z 2 2 G P D L G P D L G P Z 1 1 D L Z 1 1 Z 1 1 Z 1 2 G Z 2 2 P D L G Z 1 2 Z 1 2 P Z 1 1 D L Z 1 1 G P D L G P Z 2 1 D L Z 1 1 Z 2 2 G P D L G Z 2 1 Z 1 1 Z 2 2 P D L G Z 1 1 P...
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 7604kb
input:
200 1000 1000000 193 196 0 110 183 0 78 72 0 160 46 0 185 62 0 61 56 0 122 60 0 79 188 0 100 171 0 112 60 0 141 191 0 122 58 0 79 181 0 28 24 0 115 121 0 26 17 0 103 89 0 100 138 0 58 5 0 97 174 0 137 40 0 112 104 0 45 142 0 187 17 0 45 135 0 193 152 0 13 178 0 174 36 0 157 196 0 104 55 0 165 46 0 1...
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #4:
score: 0
Skipped
Dependency #1:
0%