top of page

CCC 2015 J4: Wait Time

Updated: Nov 1, 2020

M = int(input())
f = [0]*101
r = [0]*101
s = [0]*101
time = 0
for i in range(M):
    ss = input().split()
    cmd = ss[0]
    n = int(ss[1])
    if cmd == 'S':
        f[n] += time - s[n]
        r[n] = 1
    elif cmd == "R":
        r[n] = -1
        s[n] = time
    else:
        time += n-2
    time += 1
for j in range(101):
    if r[j] != 0:
        if r[j] > 0:
            print(j, f[j])
        else:
            print(j, r[j])


Recent Posts

See All

CCC '24 J5 - Harvest Waterloo

#include<iostream> #include <vector> #include <algorithm> #include <cmath> #include <stack> using namespace std; int main() { int r, c, sr, sc; cin >> r; cin >> c; int p[r][c]; bool v

CCC '24 J4 - Troublesome Keys

#include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main() { string ps; string ds; cin >> ps; cin >> ds;

CCC '22 J5 - Square Pool

#include<iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; bool rowcom(pair<int, int> a, pair<int, int> b){ return a.first < b.first; } bool colcom(pair<int,

Comments


bottom of page