QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#785710#4953. Displacing ParticlesWeaRD276#TL 78ms22204kbC++201.3kb2024-11-26 18:54:322024-11-26 18:54:34

Judging History

你现在查看的是最新测评结果

  • [2024-11-26 18:54:34]
  • 评测
  • 测评结果:TL
  • 用时:78ms
  • 内存:22204kb
  • [2024-11-26 18:54:32]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<db, db> pdd;
typedef pair<ll, ll> pll;


int solve()
{
	int n, x, y;
	if (!(cin >> n >> x >> y))
		return 1;
	
	int c = 1 << (n);
	
	vector<set<int>> v(21);
	v[0] = {c / 2};
	FOR (i, 1, 21)
	{
		for (int el: v[i - 1])
		{
			v[i].insert(el / 2);
			v[i].insert((el + c) / 2);
		}
	}
	int d1 = 47, d2 = 47;
	FOR (i, 0, 21)
	{
		if (v[i].count(x))
			d1 = min(d1, i);
		if (v[i].count(y))
			d2 = min(d2, i);
	}
	int ans = max(d1, d2);
	cout << ans << '\n';
	
	return 0;
}

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int TET = 1e9;
	//cin >> TET;
	for (int i = 1; i <= TET; i++)
	{
		if (solve())
		{
			break;
		}
		#ifdef ONPC
			cerr << "_____________________________\n";
		#endif
	}
	#ifdef ONPC
		cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
	#endif
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3544kb

input:

1 1 1

output:

0

result:

ok single line: '0'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

4 12 4

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

4 3 1

output:

3

result:

ok single line: '3'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

2 2 2

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

2 3 3

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

1 1 1

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

1 1 1

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

5 6 18

output:

3

result:

ok single line: '3'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

7 100 44

output:

4

result:

ok single line: '4'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3872kb

input:

7 60 4

output:

4

result:

ok single line: '4'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

5 14 2

output:

3

result:

ok single line: '3'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3972kb

input:

8 99 117

output:

7

result:

ok single line: '7'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

6 16 16

output:

1

result:

ok single line: '1'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3708kb

input:

8 104 152

output:

4

result:

ok single line: '4'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

9 154 374

output:

7

result:

ok single line: '7'

Test #16:

score: 0
Accepted
time: 2ms
memory: 4120kb

input:

10 448 960

output:

3

result:

ok single line: '3'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

8 92 68

output:

5

result:

ok single line: '5'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3680kb

input:

8 64 192

output:

1

result:

ok single line: '1'

Test #19:

score: 0
Accepted
time: 3ms
memory: 4660kb

input:

11 1536 512

output:

1

result:

ok single line: '1'

Test #20:

score: 0
Accepted
time: 0ms
memory: 4596kb

input:

11 1792 768

output:

2

result:

ok single line: '2'

Test #21:

score: 0
Accepted
time: 2ms
memory: 4860kb

input:

11 128 384

output:

3

result:

ok single line: '3'

Test #22:

score: 0
Accepted
time: 3ms
memory: 4580kb

input:

11 1856 1344

output:

4

result:

ok single line: '4'

Test #23:

score: 0
Accepted
time: 1ms
memory: 4380kb

input:

10 35 937

output:

9

result:

ok single line: '9'

Test #24:

score: 0
Accepted
time: 5ms
memory: 5516kb

input:

12 2411 3263

output:

11

result:

ok single line: '11'

Test #25:

score: 0
Accepted
time: 5ms
memory: 5724kb

input:

12 3164 2980

output:

9

result:

ok single line: '9'

Test #26:

score: 0
Accepted
time: 5ms
memory: 5648kb

input:

12 3072 3072

output:

1

result:

ok single line: '1'

Test #27:

score: 0
Accepted
time: 18ms
memory: 9676kb

input:

14 3200 1408

output:

6

result:

ok single line: '6'

Test #28:

score: 0
Accepted
time: 5ms
memory: 5516kb

input:

12 3776 704

output:

5

result:

ok single line: '5'

Test #29:

score: 0
Accepted
time: 78ms
memory: 22204kb

input:

16 57344 8192

output:

2

result:

ok single line: '2'

Test #30:

score: -100
Time Limit Exceeded

input:

19 311296 311296

output:


result: