Submission #258627

# Submission time Handle Problem Language Result Execution time Memory
258627 2020-08-06T09:26:55 Z dolphingarlic Tram (CEOI13_tram) C++14
0 / 100
1000 ms 492 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int cnt = 0;
pair<int, int> pos[100001];
set<pair<int, int>> active;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    while (m--) {
        char c;
        cin >> c;
        if (c == 'E') {
            cnt++;
            if (!active.size()) pos[cnt] = {1, 1};
            else {
                pair<double, pair<int, int>> best = {0, {0, 0}};
                for (int i = 1; i <= n; i++) {
                    for (int j = 1; j < 3; j++) {
                        double dist = 1e18;
                        for (pair<int, int> k : active) {
                            dist = min(dist, hypot(k.first - i, k.second - j));
                        }
                        if (dist > best.first) best = {dist, {i, j}};
                    }
                }
                pos[cnt] = best.second;
            }
            active.insert(pos[cnt]);
            cout << pos[cnt].first << ' ' << pos[cnt].second << '\n';
        } else {
            int i;
            cin >> i;
            active.erase(pos[i]);
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -