제출 #1165729

#제출 시각아이디문제언어결과실행 시간메모리
1165729nguynIntercastellar (JOI22_ho_t1)C++20
100 / 100
42 ms5444 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define F first #define S second #define pb push_back #define pii pair<int,int> const int N = 2e5 + 5; int n, q; pii a[N]; signed main(){ ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ; if (fopen("INP.INP" ,"r")) { freopen("INP.INP" ,"r" , stdin) ; freopen("OUT.OUT" , "w" , stdout) ; } cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].F; a[i].S = 1; while(a[i].F % 2 == 0) { a[i].F /= 2; a[i].S *= 2; } } cin >> q; int i = 0; int cur = 0; while(q--) { int x; cin >> x; while(cur < x) { i++; cur += a[i].S; } cout << a[i].F << '\n'; } }

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

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