QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#398195#3622. Weighty Tomesnunezal_AC ✓145ms4184kbC++171.8kb2024-04-25 07:46:282024-04-25 07:46:29

Judging History

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

  • [2024-04-25 07:46:29]
  • 评测
  • 测评结果:AC
  • 用时:145ms
  • 内存:4184kb
  • [2024-04-25 07:46:28]
  • 提交

answer

#include<bits/stdc++.h>

#ifdef jlocal
#include<jdebug/debug.hpp>
#else
#define debug(...) 0;
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vpl;
#define all(x) x.begin(),x.end()

const ld pi = 3.14159265358979323846L;
const ld sqrt2 = 1.41421356237309504880L;
const ll p = 73;
const ll mod = 1e9 + 123;

const int maxn = 10000;
const int maxm = 100;

int dp[maxm+1][maxn+1] = {0};

void solve(int caso){
	//altura maxima y numero de pallets
	int n, m; cin >> n >> m;

	//vector<vi> dp(m+1, vi(n+1, 0));

	//Caso base, 1 pallet, pruebo todas las alturas
	for(int j=0; j<=n; j++){
		dp[1][j] = j;
	}

	// encontrar la cantidad

	//para cada pallet
	for(int k = 2; k <= m; k++){
		//para cada distancia (d)
		for(int d = 1; d <= n; d++){
			int minimo = n+1;
			//para cada altura (h)
			for(int h = 0; h < d; h++){
				int maximo = max(dp[k-1][h],dp[k][d-h-1]);
				minimo = min(minimo,maximo);
			}
			dp[k][d] = 1 + minimo;
		}
	}

	//encontrar el rango de valores

	// valores mas grandes al rango
	int lo = -1, hi = n+1;

	//reviso la ultima fila de mi dp
    for(int d=0; d<n; d++) {
		// calculo la dp basicamente
		int maximo = max(dp[m-1][d], dp[m][n-d-1]);
		// 
        if (maximo + 1 == dp[m][n]){
            hi = d+1;
            if (lo == -1)
                lo = d+1;
        }

    }
    cout << dp[m][n] << ' ';
    if (hi > lo)
        cout << lo << '-' << hi;
	else cout << lo;
    cout << endl;
}

int main(){
#ifndef jlocal
	ios::sync_with_stdio(0); cin.tie(0);
#endif

	int t = 1; //cin >> t;
	while(t--) solve(t);

    return 0;
}

詳細信息

Test #1:

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

input:

3 1

output:

3 1

result:

ok single line: '3 1'

Test #2:

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

input:

3 2

output:

2 2

result:

ok single line: '2 2'

Test #3:

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

input:

4 2

output:

3 1-3

result:

ok single line: '3 1-3'

Test #4:

score: 0
Accepted
time: 145ms
memory: 4184kb

input:

5000 20

output:

13 905-4096

result:

ok single line: '13 905-4096'

Test #5:

score: 0
Accepted
time: 65ms
memory: 3900kb

input:

5000 10

output:

13 918-4017

result:

ok single line: '13 918-4017'

Test #6:

score: 0
Accepted
time: 31ms
memory: 3768kb

input:

5000 5

output:

16 57-1941

result:

ok single line: '16 57-1941'

Test #7:

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

input:

5000 1

output:

5000 1

result:

ok single line: '5000 1'

Test #8:

score: 0
Accepted
time: 98ms
memory: 4040kb

input:

4000 20

output:

12 1953-2048

result:

ok single line: '12 1953-2048'

Test #9:

score: 0
Accepted
time: 44ms
memory: 3916kb

input:

4000 10

output:

12 1954-2036

result:

ok single line: '12 1954-2036'

Test #10:

score: 0
Accepted
time: 20ms
memory: 3744kb

input:

4000 5

output:

15 528-1471

result:

ok single line: '15 528-1471'

Test #11:

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

input:

4000 1

output:

4000 1

result:

ok single line: '4000 1'

Test #12:

score: 0
Accepted
time: 49ms
memory: 3900kb

input:

3000 20

output:

12 953-2048

result:

ok single line: '12 953-2048'

Test #13:

score: 0
Accepted
time: 25ms
memory: 3820kb

input:

3000 10

output:

12 954-2036

result:

ok single line: '12 954-2036'

Test #14:

score: 0
Accepted
time: 11ms
memory: 3724kb

input:

3000 5

output:

14 621-1093

result:

ok single line: '14 621-1093'

Test #15:

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

input:

3000 1

output:

3000 1

result:

ok single line: '3000 1'

Test #16:

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

input:

100 1

output:

100 1

result:

ok single line: '100 1'

Test #17:

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

input:

100 2

output:

14 9-14

result:

ok single line: '14 9-14'

Test #18:

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

input:

100 3

output:

9 8-37

result:

ok single line: '9 8-37'

Test #19:

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

input:

100 4

output:

8 2-64

result:

ok single line: '8 2-64'

Test #20:

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

input:

100 5

output:

7 38-57

result:

ok single line: '7 38-57'

Test #21:

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

input:

100 6

output:

7 37-63

result:

ok single line: '7 37-63'

Test #22:

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

input:

100 7

output:

7 37-64

result:

ok single line: '7 37-64'

Test #23:

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

input:

100 8

output:

7 37-64

result:

ok single line: '7 37-64'

Test #24:

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

input:

100 9

output:

7 37-64

result:

ok single line: '7 37-64'

Test #25:

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

input:

100 10

output:

7 37-64

result:

ok single line: '7 37-64'

Test #26:

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

input:

100 11

output:

7 37-64

result:

ok single line: '7 37-64'

Test #27:

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

input:

100 12

output:

7 37-64

result:

ok single line: '7 37-64'

Test #28:

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

input:

100 13

output:

7 37-64

result:

ok single line: '7 37-64'

Test #29:

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

input:

100 14

output:

7 37-64

result:

ok single line: '7 37-64'

Test #30:

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

input:

100 15

output:

7 37-64

result:

ok single line: '7 37-64'

Test #31:

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

input:

100 16

output:

7 37-64

result:

ok single line: '7 37-64'

Test #32:

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

input:

100 17

output:

7 37-64

result:

ok single line: '7 37-64'

Test #33:

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

input:

100 18

output:

7 37-64

result:

ok single line: '7 37-64'

Test #34:

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

input:

100 19

output:

7 37-64

result:

ok single line: '7 37-64'

Test #35:

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

input:

100 20

output:

7 37-64

result:

ok single line: '7 37-64'

Test #36:

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

input:

10 5

output:

4 3-8

result:

ok single line: '4 3-8'

Test #37:

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

input:

10 2

output:

4 4

result:

ok single line: '4 4'

Test #38:

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

input:

10 10

output:

4 3-8

result:

ok single line: '4 3-8'

Test #39:

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

input:

10 15

output:

4 3-8

result:

ok single line: '4 3-8'

Test #40:

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

input:

10 20

output:

4 3-8

result:

ok single line: '4 3-8'

Test #41:

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

input:

2441 3

output:

25 117-301

result:

ok single line: '25 117-301'

Test #42:

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

input:

2011 3

output:

23 218-254

result:

ok single line: '23 218-254'

Test #43:

score: 0
Accepted
time: 28ms
memory: 3852kb

input:

2945 13

output:

12 898-2048

result:

ok single line: '12 898-2048'

Test #44:

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

input:

3449 11

output:

12 1402-2047

result:

ok single line: '12 1402-2047'

Test #45:

score: 0
Accepted
time: 28ms
memory: 3756kb

input:

3019 11

output:

12 972-2047

result:

ok single line: '12 972-2047'

Test #46:

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

input:

3952 1

output:

3952 1

result:

ok single line: '3952 1'