# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
82639 | 2018-11-01T08:30:30 Z | farukkastamonuda | Taxis (POI13_tak) | C++14 | 167 ms | 32720 KB |
#include <bits/stdc++.h> #define fi first #define se second #define lo long long #define inf 1000000009 #define md 1000000007 #define li 500005 #define mp make_pair #define pb push_back using namespace std; int m,d,n,A[li],sum,tut=1,kullan[li]; void fail(){ printf("0\n"); exit(0); } int main(){ scanf("%d %d %d",&m,&d,&n); sum=d; for(int i=1;i<=n;i++) scanf("%d",&A[i]); sum=d; sort(A+1,A+n+1,greater<int>()); if(A[1]<m-d) fail(); for(int i=2;i<=n;i++){ if(A[i]>=m-d){ tut=i; } else break; } for(int i=1;i<=tut-1;i++) kullan[i]=1; for(int i=1;i<=n;i++){ if(i==tut) continue; if(kullan[i]==1){ if(A[i]<=sum) fail(); A[i]-=sum; sum-=A[i]; if(sum<=0){ printf("%d\n",i+1); return 0; } } else{ if(A[i]<=sum) fail(); A[i]-=sum; sum-=A[i]; if(sum<=0){ printf("%d\n",i); return 0; } } } fail(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Incorrect | 3 ms | 632 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 632 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 1424 KB | Output is correct |
2 | Correct | 6 ms | 1424 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 4048 KB | Output is correct |
2 | Incorrect | 72 ms | 8352 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 111 ms | 12528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 167 ms | 22112 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 143 ms | 32720 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |