QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#46587 | #1956. Find The House | meomeo# | WA | 2ms | 3768kb | C++ | 978b | 2022-08-30 14:41:08 | 2022-08-30 14:41:09 |
Judging History
answer
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>,
rb_tree_tag,tree_order_statistics_node_update>;
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
// freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int n;
while (cin >> n) {
if (n == 0) {
break;
}
map<int, int> a;
for (int i = 0 ; i < n ; i++) {
int pos;
char t;
int d;
cin >> pos >> t >> d;
if (t == 'L') {
d *= -1;
}
a[pos] = pos + d;
}
int pos = 0;
while (a.find(pos) != a.end()) {
pos = a[pos];
}
cout << pos << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3768kb
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
Wrong Answer
time: 2ms
memory: 3664kb
input:
5 10 L 7 1 R 4 -1 R 11 5 L 6 3 L 3 1
output:
0 0
result:
wrong output format Extra information in the output file