답안 #972343

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
972343 2024-04-30T11:19:41 Z vjudge1 Art Exhibition (JOI18_art) C++17
10 / 100
1000 ms 2648 KB
/* 
 * imaN
 * 49
 * 
 * 
**/
#include <bits/stdc++.h>
using namespace std;
     
#define ll long long
#define FF first
#define SS second
#define pb push_back
#define bp pop_back()
#define int long long
#define ld long double
#define pf push_front
#define Imansoska ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define endl cout << "\n"
 
/*int binpow (int a, int n, int m) {
    if (n == 0)
        return 1%m;
    if (n % 2 == 1)
        return binpow (a, n-1,m) * a%m;
    else {
        int b = binpow (a, n/2,m);
        return b * b%m;
    }
}
 
int lcm(int a, int b) {
    return (a / __gcd(a, b)) * b;
}*/

const int N = (1e5+13)*5;
const int maxn= 1e6+10;
const int MOD = 1e9 + 7;
const int INF = 1e18 + 7;

int z[N] , a[N] , ans=-INF , n;

void rec(int v,int mn,int mx,int s) {
	ans=max(ans,s-(mx-mn));
	for ( int i=v+1; i<=n; i++ ) {
		rec(i,min(mn,z[i]),max(mx,z[i]),s+a[i]);
	}
}

signed main (/*Imansoska*/) {
	Imansoska
//	freopen("lepus.in","r",stdin);
//	freopen("lepus.out","w",stdout);
	cin >> n;
	for ( int i=1; i<=n; i++ ) {
		cin >> z[i] >> a[i];
	}
	for ( int i=1; i<=n; i++ ) {
		rec(i,z[i],z[i],a[i]);
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2524 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2524 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Execution timed out 1076 ms 2396 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2524 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Execution timed out 1076 ms 2396 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2524 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Execution timed out 1076 ms 2396 KB Time limit exceeded
13 Halted 0 ms 0 KB -