제출 #1171669

#제출 시각아이디문제언어결과실행 시간메모리
1171669SmuggingSpunIntercastellar (JOI22_ho_t1)C++20
100 / 100
58 ms3020 KiB
#include<bits/stdc++.h> #define taskname "A" using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } int n; cin >> n; vector<int>a(n); for(int& x : a){ cin >> x; } int q; cin >> q; ll sum = 0; for(int _ = 0, i = 0; _ < q; _++){ ll x; cin >> x; while(sum < x){ int cnt = 1; while(~a[i] & 1){ a[i] >>= 1; cnt <<= 1; } sum += cnt; i++; } cout << a[i - 1] << "\n"; } }

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

Main.cpp: In function 'int main()':
Main.cpp:8:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...