提出 #1611079
ソースコード 拡げる
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define FOR(i,bg,ed) for(int i=bg;i<ed;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
int main(){
int N;
cin>>N;
vector<LL> v;
LL cost=0;
int ret=N;
REP(i,N){
int c,g;
cin>>c>>g;
v.pb(c+g);
cost+=-c;
}
sort(ALL(v));
reverse(ALL(v));
REP(i,N){
if(cost>=0){
cout<<ret<<endl;
return 0;
}
ret--;
cost+=v[i];
}
cout<<0<<endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | K - パンプキン |
| ユーザ | kishimen |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 1 |
| コード長 | 617 Byte |
| 結果 | AC |
| 実行時間 | 91 ms |
| メモリ | 1400 KiB |
ジャッジ結果
| セット名 | sample | all | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 1 / 1 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| sample | sample-01.txt, sample-02.txt, sample-03.txt |
| all | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, sample-01.txt, sample-02.txt, sample-03.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01-01.txt | AC | 1 ms | 256 KiB |
| 01-02.txt | AC | 1 ms | 256 KiB |
| 01-03.txt | AC | 1 ms | 256 KiB |
| 01-04.txt | AC | 1 ms | 256 KiB |
| 01-05.txt | AC | 1 ms | 256 KiB |
| 01-06.txt | AC | 1 ms | 256 KiB |
| 01-07.txt | AC | 1 ms | 256 KiB |
| 01-08.txt | AC | 1 ms | 256 KiB |
| 01-09.txt | AC | 1 ms | 256 KiB |
| 01-10.txt | AC | 2 ms | 256 KiB |
| 01-11.txt | AC | 3 ms | 256 KiB |
| 01-12.txt | AC | 5 ms | 384 KiB |
| 01-13.txt | AC | 9 ms | 512 KiB |
| 01-14.txt | AC | 9 ms | 512 KiB |
| 01-15.txt | AC | 21 ms | 640 KiB |
| 01-16.txt | AC | 27 ms | 640 KiB |
| 01-17.txt | AC | 57 ms | 892 KiB |
| 01-18.txt | AC | 85 ms | 1400 KiB |
| 01-19.txt | AC | 87 ms | 1400 KiB |
| 01-20.txt | AC | 91 ms | 1400 KiB |
| 01-21.txt | AC | 85 ms | 1400 KiB |
| 01-22.txt | AC | 63 ms | 1400 KiB |
| 01-23.txt | AC | 63 ms | 1400 KiB |
| 01-24.txt | AC | 87 ms | 1400 KiB |
| sample-01.txt | AC | 1 ms | 256 KiB |
| sample-02.txt | AC | 1 ms | 256 KiB |
| sample-03.txt | AC | 1 ms | 256 KiB |