답안 #692871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
692871 2023-02-02T06:41:40 Z saayan007 Lightning Rod (NOI18_lightningrod) C++17
14 / 100
1754 ms 223504 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vpi = vector<pi>;
using vpl = vector<pl>;

#define fur(i, a, b) for(ll i = a; i <= (ll) b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll) b; --i)
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define nl "\n"

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll n;
    cin >> n;

#define x first
#define y second
    pl a[n + 2];
    fur(i, 1, n) {
        cin >> a[i].x >> a[i].y;
    }
    a[0] = a[n + 1] = {0, 0};
    sort(a + 1, a + n + 1);

    ll ans = n;
    fur(i, 1, n) {
        if(a[i].y == 0 && (a[i - 1].y == 1 || a[i + 1].y == 1))
            --ans;
    }
    cout << ans << nl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1754 ms 152056 KB Output is correct
2 Correct 1539 ms 151588 KB Output is correct
3 Correct 1438 ms 147512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1690 ms 156236 KB Output is correct
2 Correct 1689 ms 201488 KB Output is correct
3 Correct 1577 ms 223504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1754 ms 152056 KB Output is correct
2 Correct 1539 ms 151588 KB Output is correct
3 Correct 1438 ms 147512 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -