結果
問題 |
No.2056 非力なレッド
|
ユーザー |
![]() |
提出日時 | 2022-09-02 13:03:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,344 bytes |
コンパイル時間 | 2,345 ms |
コンパイル使用メモリ | 220,560 KB |
最終ジャッジ日時 | 2025-02-07 00:35:27 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:51:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 51 | freopen("input.txt","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ main.cpp:52:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 52 | freopen("output.txt","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC optimize(2) #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef string str; typedef pair<ll,ll> pii; #define F first #define S second #define pb push_back #define pq priority_queue #define all(x) (x).begin(),(x).end() #define de_bug(x) cout << (x) << '\n' #define loli(x) cout << (x) << ' ' #define yn(x) cout << (x==1?"Yes\n":"No\n") #define PI 3.14159265358979323 #define lolicon ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) const ll max_n=1e5+10,mod1=1e9+7,mod2=998244353; ll dx[8] = {1,0,0,-1,1,1,-1,-1}; ll dy[8] = {0,1,-1,0,1,-1,1,-1}; ll n,x,m,k,t,a,cnt[max_n]; vector<ll> v; void solve(){ cin >> n >> x >> m; for(ll i=0;i<n;i++){ cin >> a; v.pb(a); for(ll j=a;j>=x;j=j/2){ cnt[i]++; } }/* for(ll i=0;i<n;i++){ cout << cnt[i] << ' '; } cout << '\n';*/ ll now = 0; for(ll i=n-1;i>=0;i--){ if(cnt[i]-now>0){ m -= (cnt[i]-now)*(i+1); now = cnt[i]; } } //cout << m << '\n'; yn(m>=0); } int main(){ lolicon; ///* freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); //*/ //cin >> t; t = 1; for(ll i=1;i<=t;i++){ //cout << "Case #"<<i<<": "; solve(); } } /* 1 2 */