結果

問題 No.231 めぐるはめぐる (1)
ユーザー suzuishisuzuishi
提出日時 2022-04-17 19:03:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 2,024 bytes
コンパイル時間 1,771 ms
コンパイル使用メモリ 174,508 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 03:52:37
合計ジャッジ時間 2,633 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 35/40
#include <bits/stdc++.h>
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) a.begin(),a.end()
#define PB(a) push_back(a)
#define FS first
#define SD second
#define SEP(i,n) (i==n-1?'\n':' ')
#define PUTNUM(a,b,c) (a==b?c:a)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using VI=vector<int>;
using VVI=vector<VI>;
using VVVI=vector<VVI>;
using VL=vector<ll>;
using VVL=vector<VL>;
using VVVL=vector<VVL>;
using VB=vector<bool>;
using VVB=vector<VB>;
using VP=vector<P>;
using VVP=vector<VP>;
using VS=vector<string>;
const int dx[]={0,-1,1,0},dy[]={-1,0,0,1};
//const int dx[]={-1,0,1,-1,1,-1,0,1},dy[]={-1,-1,-1,0,0,1,1,1};
template<typename T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T>T eucld(T a,T b){if(a<b)swap(a,b);while(a%b){T q=a%b;a=b;b=q;}return b;}
ll modpow(ll a,ll k,ll m=MOD){a%=m;if(a==0)return 0;ll r=1;while(k>0){if(k&1)r=r*a%m;a=a*a%m;k>>=1;}return r;}
struct UnionFind{VI v;UnionFind(int n):v(n){rep(i,n)v[i]=i;}int root(int x){if(v[x]==x)return x;return v[x]=root(v[x]);}void unite(int x,int y){int a=root(x),b=root(y);if(a!=b)v[a]=b;}bool same(int x,int y){return root(x)==root(y);}};

int main(void) {
   cin.tie(0);
   ios::sync_with_stdio(0);
   cout << fixed << setprecision(7);
   int n; cin >> n;
   VP a(n);
   rep(i,n) {
      int g,d; cin >> g >> d;
      a[i].FS=g-30000*d;
      a[i].SD=i+1;
   }
   sort(ALL(a),greater<P>{});
   if(a[0].FS*6<3000000) cout << "NO" << endl;
   else {
      cout << "YES" << endl;
      ll sum=a[0].FS*6;
      VI ans;
      for(auto i:a) {
         if(sum-(a[0].FS-i.FS)>=3000000) {
            ans.PB(i.SD);
            sum-=a[0].FS-i.FS;
         }
      }
      rep(i,6) {
         if(i<ans.size()) cout << ans[i] << endl;
         else cout << a[0].SD << endl;
      }
   }
   return 0;
}
0