답안 #345043

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
345043 2021-01-06T23:55:26 Z nishuz Lightning Rod (NOI18_lightningrod) C++14
44 / 100
2000 ms 88044 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, ans = 0, subtask = 1;
    cin >> n;
    vector <pair <int, int>> a(n);
    bool vis[n], ok = 1;
    memset(vis, 0, sizeof vis);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i].first >> a[i].second;
        ok &= (a[i].second == 1);
        if (i) subtask += (a[i].first != a[i-1].first);
    }
    if (ok)
    {
        cout << subtask << '\n';
        return 0;
    }
    sort(a.begin(), a.end(), [&](pair <int, int>& a, pair <int, int>& b) {return a.second > b.second;});
    for (int i = 0; i < n; ++i)
    {
        if (vis[i]) continue;
        ++ans;
        for (int j = i; j < n; ++j) if (abs(a[i].first - a[j].first) <= abs(a[i].second - a[j].second)) vis[j] = 1;
    }
    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1708 ms 85740 KB Output is correct
2 Correct 1718 ms 85484 KB Output is correct
3 Correct 1624 ms 83180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 5 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 5 ms 364 KB Output is correct
14 Correct 343 ms 1900 KB Output is correct
15 Correct 284 ms 2028 KB Output is correct
16 Execution timed out 2090 ms 1900 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2091 ms 88044 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1708 ms 85740 KB Output is correct
2 Correct 1718 ms 85484 KB Output is correct
3 Correct 1624 ms 83180 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 5 ms 364 KB Output is correct
17 Correct 343 ms 1900 KB Output is correct
18 Correct 284 ms 2028 KB Output is correct
19 Execution timed out 2090 ms 1900 KB Time limit exceeded