//!yrt tsuj uoy srettam gnihton no emoc
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
void solve(vector <pii> a, vector <pii> b){
if((int)a.size() == 1){
cout << a[0].S << " " << b[0].S << endl;
return;
}
vector <pii> a1, a2, b1, b2;
for(auto u : a){
if(u.F & 1){
a2.pb({u.F / 2, u.S});
}else{
a1.pb({u.F / 2, u.S});
}
}
if((int)a1.size() != (int)a2.size() && (b[0].F & 1)){
b[0].F --;
}
for(auto u : b){
if(u.F & 1){
b2.pb({u.F / 2, u.S});
}else{
b1.pb({u.F / 2, u.S});
}
}
solve(a1, b1);
solve(a2, b2);
}
int main(){
fast_io;
int n, m;
cin >> n >> m;
vector <pii> a, b;
for(int i = 0; i < n; i ++){
a.pb({i, i});
b.pb({m + i, m + i});
}
solve(a, b);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
702 ms |
24332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
588 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
697 ms |
24380 KB |
Output is correct |
7 |
Correct |
371 ms |
11916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
702 ms |
24332 KB |
Output is correct |
5 |
Correct |
11 ms |
588 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
332 KB |
Output is correct |
10 |
Correct |
697 ms |
24380 KB |
Output is correct |
11 |
Correct |
371 ms |
11916 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
308 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
2 ms |
332 KB |
Output is correct |
18 |
Correct |
2 ms |
332 KB |
Output is correct |
19 |
Correct |
142 ms |
5432 KB |
Output is correct |
20 |
Correct |
546 ms |
19380 KB |
Output is correct |
21 |
Correct |
18 ms |
940 KB |
Output is correct |
22 |
Correct |
8 ms |
640 KB |
Output is correct |
23 |
Correct |
785 ms |
29292 KB |
Output is correct |
24 |
Execution timed out |
1068 ms |
45332 KB |
Time limit exceeded |
25 |
Halted |
0 ms |
0 KB |
- |