제출 #1039500

#제출 시각아이디문제언어결과실행 시간메모리
1039500coolsentenceidontremember은행 (IZhO14_bank)C++17
100 / 100
86 ms8792 KiB
#include<bits/stdc++.h> #pragma GCC optimize("O3", "unroll-loops") #define ll long long #define ld long double #define ff first #define ss second #define db double #define time_begin() auto begin = chrono::high_resolution_clock::now() #define time_end() auto end = chrono::high_resolution_clock::now(); auto elapsed = chrono::duration_cast<chrono::nanoseconds>(end-begin); auto sec = elapsed.count() * 1e-9; cerr << "\n\nExecution time: " << sec << " seconds"; #define check_time() cerr << "\nStatus : "; if (sec>1) cerr << "Time Limit Exceeded 1!!!1!111"; else cerr << "You good brother" using namespace std; void setIO(string s = ""){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); if (!s.empty()){ freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } } int main(){ setIO(); int n, m; cin >> n >> m; int ppl[n], bank[m]; for (int &i : ppl) cin >> i; for (int &i : bank) cin >> i; vector<int> left(1<<m, 0), cover(1<<m, -1); cover[0] = 0; for (int mask = 0; mask < (1<<m); mask++){ for (int b = 0; b < m; b++){ if (mask & (1<<b)){ int prev = mask^(1<<b); if (cover[prev] == -1) continue; int target = ppl[cover[prev]]; int cur_tenge = left[prev]+bank[b]; if (cur_tenge < target){ left[mask] = cur_tenge; cover[mask] = cover[prev]; } else if (cur_tenge==target){ cover[mask] = cover[prev]+1; left[mask] = 0; } } } if (cover[mask] == n){ cout << "YES"; return 0; } } return cout << "NO", 0; }

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp: In function 'void setIO(std::string)':
bank.cpp:22:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  freopen((s+".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:23:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  freopen((s+".out").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...