Submission #588056

# Submission time Handle Problem Language Result Execution time Memory
588056 2022-07-02T16:43:12 Z Mounir Intercastellar (JOI22_ho_t1) C++14
100 / 100
451 ms 9260 KB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;

signed main(){ 
      int nVals; cin >> nVals;
      vector<int> vals(nVals), nPieces;
      for (int& val : vals){
            cin >> val;
            int ordre = 1;
            while (val%2 == 0){
                  val /= 2;
                  ordre *= 2;
            }
            
            if (nPieces.empty())
                  nPieces.pb(ordre);
            else
                  nPieces.pb(nPieces.back() + ordre);
      }

      int nReqs; cin >> nReqs;
      while (nReqs--){
            int x; cin >> x;
            int id = lower_bound(all(nPieces), x) - nPieces.begin();
         //   cout << "ans";
            cout << vals[id] << endl;
      }
      return 0;   
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 91 ms 4424 KB Output is correct
4 Correct 230 ms 2472 KB Output is correct
5 Correct 360 ms 5824 KB Output is correct
6 Correct 178 ms 4160 KB Output is correct
7 Correct 335 ms 5648 KB Output is correct
8 Correct 332 ms 5720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 91 ms 4424 KB Output is correct
4 Correct 230 ms 2472 KB Output is correct
5 Correct 360 ms 5824 KB Output is correct
6 Correct 178 ms 4160 KB Output is correct
7 Correct 335 ms 5648 KB Output is correct
8 Correct 332 ms 5720 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 304 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 3 ms 340 KB Output is correct
20 Correct 3 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 3 ms 340 KB Output is correct
23 Correct 212 ms 3080 KB Output is correct
24 Correct 191 ms 5256 KB Output is correct
25 Correct 396 ms 8916 KB Output is correct
26 Correct 235 ms 5696 KB Output is correct
27 Correct 209 ms 5748 KB Output is correct
28 Correct 424 ms 9260 KB Output is correct
29 Correct 451 ms 8964 KB Output is correct
30 Correct 281 ms 3768 KB Output is correct
31 Correct 432 ms 9200 KB Output is correct