結果
問題 | No.231 めぐるはめぐる (1) |
ユーザー |
|
提出日時 | 2022-04-17 19:03:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 2,024 bytes |
コンパイル時間 | 1,962 ms |
コンパイル使用メモリ | 174,940 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 11:24:22 |
合計ジャッジ時間 | 2,914 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
// 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;}