# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
36595 | 2017-12-11T17:20:36 Z | WhipppedCream | Taxis (POI13_tak) | C++14 | 186 ms | 5920 KB |
#include <bits/stdc++.h> //#ifdef atom #else #endif using namespace std; typedef long long ll; typedef pair<int, int> ii; #define X first #define Y second #define vi vector<int> #define vvi vector< vi > #define vii vector< ii > #define mp make_pair #define pb push_back const int maxn = 5e5+5; ll x[maxn]; int n; ll d, m; int LU(ll k) { return lower_bound(x, x+n, k)-x; } void fail() { puts("0"); exit(0); } void use(ll x) { int dd = min(d, x-d); d -= dd; m -= dd; } bool ok(ll x) { return x>=d+m; } int main() { //#ifndef atom //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); //#endif scanf("%lld %lld %d", &m, &d, &n); for(int i = 0; i< n; i++) scanf("%lld", &x[i]); sort(x, x+n); //if(2*d< m) //{ int pos = LU(m-d); if(pos == n) fail(); int cnt = 0; for(int i = n-1; i>= 0; i--) { if(d>x[i]) fail(); if(ok(x[i])) { printf("%d\n", cnt+1); return 0; } use(x[i]); cnt++; //cout << m << " " << d << endl; } //} printf("0\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5920 KB | Output is correct |
2 | Correct | 0 ms | 5920 KB | Output is correct |
3 | Incorrect | 0 ms | 5920 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5920 KB | Output is correct |
2 | Correct | 0 ms | 5920 KB | Output is correct |
3 | Incorrect | 0 ms | 5920 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5920 KB | Output is correct |
2 | Incorrect | 0 ms | 5920 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5920 KB | Output is correct |
2 | Incorrect | 0 ms | 5920 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 5920 KB | Output is correct |
2 | Incorrect | 3 ms | 5920 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 5920 KB | Output is correct |
2 | Incorrect | 23 ms | 5920 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 5920 KB | Output is correct |
2 | Incorrect | 83 ms | 5920 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 5920 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 186 ms | 5920 KB | Output is correct |
2 | Incorrect | 159 ms | 5920 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 5920 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |