# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28955 | 2017-07-18T01:57:38 Z | 서규호 (지각충1)(#1231) | Taxis (POI13_tak) | C++14 | 183 ms | 5924 KB |
#include <bits/stdc++.h> #include <unistd.h> #define pii pair<int,int> #define pll pair<lld,lld> #define pb push_back #define next nextt #define lld long long #define Inf 1000000000 #define Linf 1000000000000000000LL #define get gett using namespace std; int N,ans; lld D,M; lld a[500002]; void impossible(){ puts("0"); exit(0); } void print(){ printf("%d\n",ans); exit(0); } int main(){ scanf("%lld %lld %d",&D,&M,&N); for(int i=1; i<=N; i++){ scanf("%d",&a[i]); } sort(a+1,a+N+1); reverse(a+1,a+N+1); lld dis = M; int v = 0; a[N+1] = -1; if(a[1] < D-M) impossible(); for(int i=1; i<=N; i++){ if(a[i] <= dis) impossible(); if(a[i] >= D-M && a[i+1] < D-M){ v = i; continue; } dis -= (a[i]-dis); ans++; if(dis <= M-D){ print(); }else if(v == 0){ if(dis <= 0){ ans++; print(); } }else{ if(a[v] >= max((lld)0,dis)*2+D-M){ ans++; print(); } } } puts("0"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 5924 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 5924 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5924 KB | Output is correct |
2 | Correct | 0 ms | 5924 KB | Output is correct |
3 | Correct | 0 ms | 5924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5924 KB | Output is correct |
2 | Correct | 0 ms | 5924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 5924 KB | Output is correct |
2 | Correct | 3 ms | 5924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 5924 KB | Output is correct |
2 | Incorrect | 19 ms | 5924 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 5924 KB | Output is correct |
2 | Incorrect | 89 ms | 5924 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 109 ms | 5924 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 183 ms | 5924 KB | Output is correct |
2 | Incorrect | 169 ms | 5924 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 153 ms | 5924 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |