답안 #527559

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
527559 2022-02-17T16:11:32 Z SilentVisitor Intercastellar (JOI22_ho_t1) C++17
0 / 100
21 ms 3296 KB
#include<bits/stdc++.h> 
using namespace std; 

#define ll long long 
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin() c.rend()

const int N = 200010; 
ll pref[N];  
void solve(){
	  int n;
	  cin >> n; 
	  vector<int> a(n); 
	  for(auto &i : a) cin >> i; 
	  for(int i = 0; i<n; i+=1){
	  	   int find = a[i]; 
	  	   while(!(a[i]%2)) a[i] /= 2; 
	  	   pref[i] = pref[i-1] + find/a[i]; 
	  }
	  int q; 
	  cin >> q;
	  vector<int> x(q); 
	  for(auto &i : x) cin >> i; 
	  for(int i = 0; i<q; i+=1){
	  	  int tru = lower_bound(pref + 1, pref+n+1, x[i]) - pref; 
	  	  cout << a[i] << '\n'; 
	  }
}
int main(){
	 ios::sync_with_stdio(false); 
	 cin.tie(0); 
	 cout.tie(0); 
	 solve(); 
	 return 0; 
}
/*
Task 1 : 
16
536870912
402653184
536870912
536870912
134217728
536870912
671088640
536870912
536870912
536870912
939524096
805306368
536870912
956301312
536870912
536870912
5
2500000000
3355443201
4294967296
5111111111
6190792704
Sample output for the following :-> 
5
1
7
57
1

Task 2 : 
4
14
9
8
12
6
2
3
5
7
11
13
Output for the following input : 
7
9
1
1
1
3

Task 3 :->
13
1
4
1
4
2
1
3
5
6
2
3
7
3
8
2
10
11
13
15
17
18
20
Sample output for the following :-> 
1
1
1
1
5
3
1
3
*/

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:25:11: warning: unused variable 'tru' [-Wunused-variable]
   25 |       int tru = lower_bound(pref + 1, pref+n+1, x[i]) - pref;
      |           ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 21 ms 3296 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 332 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 21 ms 3296 KB Output isn't correct
4 Halted 0 ms 0 KB -