Submission #1279244

#TimeUsernameProblemLanguageResultExecution timeMemory
1279244hoa208Intercastellar (JOI22_ho_t1)C++20
100 / 100
45 ms5800 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++) #define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--) #define pa pair<ll, ll> #define fi first #define se second #define bit(mask, j) ((mask >> j) & 1) const ll mod = 1e9 + 7; const ll INF = 1e18; //-------------------------------------------------------------------- const ll N = 2e5 + 10; ll a[N], qr[N]; void hbmt() { ll n; cin >> n; FOR(i, 1, n) { cin >> a[i]; } ll q; cin >> q; FOR(i, 1, q) { cin >> qr[i]; } ll sum = 0; ll id = 1; FOR(i, 1, n) { ll val = 1; while(a[i] % 2 == 0) { a[i] /= 2; val *= 2; } sum += val; while(id <= q && qr[id] <= sum) { cout << a[i] << '\n'; id++; } } } int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); #define NAME "hbmt" if(fopen(NAME".inp", "r")) { freopen(NAME".inp", "r", stdin); freopen(NAME".out", "w", stdout); } //int t;cin>>t;while(t--) hbmt(); return 0; }

Compilation message (stderr)

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