QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#616953 | #1956. Find The House | Cheek_support# | RE | 0ms | 3884kb | C++20 | 713b | 2024-10-06 13:13:46 | 2024-10-06 13:13:48 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int read(){
char ch=getchar();int x=0,f=1;
for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
return f*x;
}
int n,m;
const int N=100100;
map<int,int> mp;
bool bo[N]={};
int main(){
n=read();
for(int i=1;i<=n;i++){
int x=read();
char ch=getchar();
int y=read();
if(ch=='L')mp[x]=x-y;
if(ch=='R')mp[x]=x+y;
}
int now=read();
for(;mp.find(now)!=mp.end()&&!bo[now];){
bo[now]=1;
now=mp[now];
}
printf("%d\n",now);
return 0;
}
/*
4
3 R 4
0 L 2
7 L 5
-2 R 5
0
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3736kb
input:
4 3 R 4 -2 R 5 7 L 5 0 L 2 0
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
5 10 L 7 1 R 4 -1 R 11 5 L 6 3 L 3 1
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
1 100 L 123 100
output:
-23
result:
ok single line: '-23'
Test #4:
score: -100
Runtime Error
input:
1000 1217 R 2 1015 R 2 1001 R 2 1281 R 2 105 R 2 1489 R 2 -481 R 2 1419 R 2 111 R 2 -287 R 2 615 R 2 -89 R 2 85 R 2 225 R 2 -443 R 2 1013 R 2 1009 R 2 1245 R 2 1057 R 2 -143 R 2 83 R 2 -103 R 2 163 R 2 -117 R 2 733 R 2 -405 R 2 751 R 2 759 R 2 1207 R 2 507 R 2 351 R 2 -343 R 2 317 R 2 -491 R 2 -421 ...