QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#556371#3965. King of cansLaVuna47#AC ✓1ms3860kbC++172.0kb2024-09-10 17:24:032024-09-10 17:24:04

Judging History

This is the latest submission verdict.

  • [2024-09-10 17:24:04]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3860kb
  • [2024-09-10 17:24:03]
  • Submitted

answer

/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, n) for(int i = 0; i < n; ++i)
#define RFOR(i, n) for(int i = n-1; i >= 0; --i)
#define output_vec(vec) { FOR(i_, sz(vec)) cout << vec[i_] << ' '; cout << '\n'; }
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<bool> vb;
typedef short si;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif


int solve()
{		
	int x, y;
	if(!(cin >> x >> y))
		return 1;
	vector<int> xx, yy;
	for (int i = 2; i <= 50; i++)
	{
		if ((100 - 2 * i) % 3 == 0)
		{
			xx.pb(i);
			yy.pb((100 - 2 * i) / 3);
		}
	}
	
	int ans = 0;
	while (x > 1 && y >= 0)
	{
		bool ok = false;
		FOR (i, sz(xx))
		{
			if (x >= xx[i] && y >= yy[i])
			{
				ans++;
				x -= xx[i];
				y -= yy[i];
				ok = true;
				break;
			}
		}
		if (!ok)
			break;
	}
	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
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3620kb

input:

50 0

output:

1

result:

ok single line: '1'

Test #2:

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

input:

5 30

output:

1

result:

ok single line: '1'

Test #3:

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

input:

49 1

output:

0

result:

ok single line: '0'

Test #4:

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

input:

0 100

output:

0

result:

ok single line: '0'

Test #5:

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

input:

4 64

output:

2

result:

ok single line: '2'

Test #6:

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

input:

4 63

output:

1

result:

ok single line: '1'

Test #7:

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

input:

3 64

output:

1

result:

ok single line: '1'

Test #8:

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

input:

49 0

output:

0

result:

ok single line: '0'

Test #9:

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

input:

40 7

output:

0

result:

ok single line: '0'

Test #10:

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

input:

5684 4439

output:

246

result:

ok single line: '246'

Test #11:

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

input:

249 371

output:

16

result:

ok single line: '16'

Test #12:

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

input:

199 75

output:

6

result:

ok single line: '6'

Test #13:

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

input:

2 150

output:

1

result:

ok single line: '1'

Test #14:

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

input:

251 8

output:

5

result:

ok single line: '5'

Test #15:

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

input:

41 27

output:

1

result:

ok single line: '1'

Test #16:

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

input:

76 113

output:

4

result:

ok single line: '4'

Test #17:

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

input:

52 154

output:

5

result:

ok single line: '5'

Test #18:

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

input:

137 30

output:

3

result:

ok single line: '3'

Test #19:

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

input:

173 94

output:

6

result:

ok single line: '6'

Test #20:

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

input:

63 0

output:

1

result:

ok single line: '1'

Test #21:

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

input:

2571 845

output:

76

result:

ok single line: '76'

Test #22:

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

input:

147 108

output:

6

result:

ok single line: '6'

Test #23:

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

input:

3 22

output:

0

result:

ok single line: '0'

Test #24:

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

input:

120 63

output:

4

result:

ok single line: '4'

Test #25:

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

input:

102 81

output:

4

result:

ok single line: '4'

Test #26:

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

input:

14 32

output:

1

result:

ok single line: '1'

Test #27:

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

input:

104 6

output:

2

result:

ok single line: '2'

Test #28:

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

input:

25 90

output:

3

result:

ok single line: '3'

Test #29:

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

input:

96 23

output:

2

result:

ok single line: '2'

Test #30:

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

input:

63 32

output:

2

result:

ok single line: '2'

Test #31:

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

input:

66 30

output:

2

result:

ok single line: '2'

Test #32:

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

input:

1443 697

output:

49

result:

ok single line: '49'

Test #33:

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

input:

52 73

output:

3

result:

ok single line: '3'

Test #34:

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

input:

927 743

output:

40

result:

ok single line: '40'

Test #35:

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

input:

131 750

output:

25

result:

ok single line: '25'

Test #36:

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

input:

342 354

output:

17

result:

ok single line: '17'

Test #37:

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

input:

426 498

output:

23

result:

ok single line: '23'

Test #38:

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

input:

101 456

output:

15

result:

ok single line: '15'

Test #39:

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

input:

153 358

output:

13

result:

ok single line: '13'