QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#617001#1956. Find The HouseFolity#TL 0ms3524kbC++20402b2024-10-06 13:23:562024-10-06 13:23:58

Judging History

你现在查看的是最新测评结果

  • [2024-10-06 13:23:58]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3524kb
  • [2024-10-06 13:23:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=1e4+5;
int n;
map<int,int> mp;
int main(){
    cin>>n;
    for(int i=1;i<=n;++i){
        int x,z;
        string y;
        cin>>x>>y>>z;
        if(y=="L")z=-z;
        mp[x]=z;
    }
    int pos=0;
    while(mp.size()){
        int npos=pos+mp[pos];
        mp.erase(pos);
        pos=npos;
    }
    cout<<pos<<'\n';
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3524kb

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: -100
Time Limit Exceeded

input:

5
10 L 7
1 R 4
-1 R 11
5 L 6
3 L 3
1

output:


result: