結果

問題 No.1015 おつりは要らないです
ユーザー Suu0313Suu0313
提出日時 2020-04-04 19:59:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 5,149 bytes
コンパイル時間 1,786 ms
コンパイル使用メモリ 177,996 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 06:08:02
合計ジャッジ時間 4,092 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 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 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 34 ms
4,376 KB
testcase_16 AC 35 ms
4,380 KB
testcase_17 AC 34 ms
4,376 KB
testcase_18 AC 34 ms
4,376 KB
testcase_19 AC 34 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 14 ms
4,376 KB
testcase_32 AC 14 ms
4,380 KB
testcase_33 AC 21 ms
4,380 KB
testcase_34 AC 2 ms
4,384 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:139:12: 警告: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
  139 | void VCout(auto v){
      |            ^~~~
main.cpp:149:12: 警告: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
  149 | void Press(auto &v){v.erase(unique(ALL(v)),v.end());}
      |            ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL,LL> PLL;
typedef map<int,int> MII;
typedef queue<int> QI;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef stack<PII> SPII;
typedef deque<int> DI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQGI; //大きい順
typedef priority_queue<int, VI, greater<int>> PQLI;
typedef priority_queue<PII> PQGP; 
typedef priority_queue<PII, VPII, greater<int>> PQLP;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define PF push_front
#define POB pop_back()
#define POF pop_front()
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
#define NEXP next_permutation
#define FI first
#define SE second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REPR(i,n) FORR(i,0,n)
#define BREP(bit,N) for (int bit = 0; bit < (1<<N); ++bit)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = INT_MAX/2;
const LL LINF = LLONG_MAX/2;
const LL MOD = 1e9+7;
const LL MODD = 998244353;
const int MAX = 510000;

inline bool Eq(double a, double b) { return fabs(b - a) < EPS; }

//other
//-------------------------------------------
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define SEP(a) cout << fixed << setprecision(a)
#define COUT(x) cout << (x) << endl
#define COUT2(x,y) cout << (x) << " " << (y) << endl
#define PR(x) cout << (x)
#define ENDL cout << endl
#define SPACE cout << " "
#define cYes COUT("Yes")
#define cNo COUT("No")
#define cYES COUT("YES")
#define cNO COUT("NO")
#define cyes COUT("yes")
#define cno COUT("no")
#define BC(x) __builtin_popcountll(x)

VI dx = {1,0,-1,0,1,1,-1,-1};
VI dy = {0,1,0,-1,1,-1,1,-1};
VC dc = {'R','D','L','U'};
VS ds = {"R","D","L","U","RD","RU","LD","LU"};

LL Gcd(LL a, LL b) {return __gcd(a,b);}
LL Lcm(LL a, LL b) {return a/Gcd(a,b)*b;}

LL ModPow(LL A, LL N, LL M){
  LL res = 1;
  while(N>0){
    if(N&1) res = res * A % M;
    A = A * A % M;
    N >>= 1;
  }
  return res;
}

LL fac[MAX], finv[MAX], inv[MAX];

void ConInit(LL M) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % M;
        inv[i] = M - inv[M%i] * (M / i) % M;
        finv[i] = finv[i - 1] * inv[i] % M;
    }
}

LL COM(int n, int k, LL M){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % M) % M;
}

void VCout(auto v){
  int N = SZ(v);
  REP(i,N){
    cout << v.at(i);
    if(i == N-1)ENDL;
    else SPACE;
  }
  return;
}

void Press(auto &v){v.erase(unique(ALL(v)),v.end());}


  

int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  SEP(12);
  
  LL N,X,Y,Z;
  cin >> N >> X >> Y >> Z;
  VLL A(N);
  REP(i,N){
    cin >> A.at(i);
    A.at(i)++;
  }
  SORTR(A);
  
  REP(i,N){
    if(A.at(i)>=10000){
      LL a = A.at(i)/10000;
      chmin(a,X);
      A.at(i) -= 10000*a;
      X -= a;
      if(X==0) break;
    }
  }
  SORTR(A);
  if(X>0){
    REP(i,N){
      A.at(i) = 0;
      X--;
      if(X==0) break;
    }
  }
  
  SORTR(A);
  
  REP(i,N){
    if(A.at(i)>=5000){
      LL a = A.at(i)/5000;
      chmin(a,Y);
      A.at(i) -= 5000*a;
      Y -= a;
      if(Y==0) break;
    }
    else break;
  }
  SORTR(A);
  if(Y>0){
    REP(i,N){
      A.at(i) = 0;
      Y--;
      if(Y==0) break;
    }
  }
  
  SORTR(A);
  
  REP(i,N){
    if(A.at(i)>=1000){
      LL a = A.at(i)*1000;
      chmin(a,Z);
      A.at(i) -= 1000*a;
      Z -= a;
      if(Z==0) break;
    }
    else break;
  }
  SORTR(A);
  if(Z>0){
    REP(i,N){
      A.at(i) = 0;
      Z--;
      if(Z==0) break;
    }
  }
  
  LL sum=0;
  
  REP(i,N){
    sum += A.at(i);
  }
  
  if(sum==0)cYes;
  else cNo;
  
  
  return 0;
}
0