답안 #918321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918321 2024-01-29T16:01:09 Z trvhung Bali Sculptures (APIO15_sculpture) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
//-----------------------
// #define   ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define            ll long long
#define           ull unsigned long long
#define            pb push_back
#define            pf push_front
#define            mp make_pair
#define      mem(f,x) memset(f, x, sizeof(f))
#define   __lcm(a, b) (1ll * a * b) / __gcd(a, b)
#define  bit(mask, i) ((mask >> i) & 1)
#define           pii pair<int, int>
#define           pll pair<ll, ll>
#define            el '\n'
#define             F first
#define             S second
#define         io(x) freopen(x".inp","r",stdin),freopen(x".out","w",stdout)
//-----------------------
const ll INF = 1e18;
const int MOD = 1e9 + 7;
const int MULTI = 0;
const int dx[4] = {0, 0, 1, -1}; //R L D U
const int dy[4] = {1, -1, 0, 0};
//-----AUTHOR trvhung VNG High School for Gifted Student-----

const int LOG = 15;
const int maxn = 2e3 + 5;
int n, A, B, a[maxn];

namespace onetwothree {
	ll dp[maxn][maxn], pref[maxn], sum;
	map<ll, set<ll> > v[maxn];

	bool check() {
		return (n <= 50 || (n == 100 && A == 1));
	}

	void solve() {
		for (int i = 1; i <= n; ++i)
			pref[i] = pref[i - 1] + a[i];

		sum = 0;
		for (int i = 1; i <= n; ++i) {
			sum += a[i];
			dp[i][1] = sum;
			v[i][1].insert(dp[i][1]);
		}

		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= min(i, B); ++j) {
				if (j == 1) continue;
				dp[i][j] = INF; sum = a[i];
				for (int k = i - 1; k >= j - 1; --k) {
					for (auto x: v[k][j - 1]) { 
						dp[i][j] = min(dp[i][j], x | sum);
						v[i][j].insert(x | sum);
					}
					sum += a[k];
				}
			}

		ll res = INF;
 		for (int i = A; i <= B; ++i)
 			res = min(res, dp[n][i]);

 		cout << res;
}



signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("input.inp", "r", stdin);
    freopen("output.out", "w", stdout);
    #endif

    cin >> n >> A >> B;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
    
    return 0;
}

Compilation message

sculpture.cpp:88:1: error: expected '}' at end of input
   88 | }
      | ^
sculpture.cpp:33:23: note: to match this '{'
   33 | namespace onetwothree {
      |                       ^
sculpture.cpp: In function 'int onetwothree::main()':
sculpture.cpp:79:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   79 |     freopen("input.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:80:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   80 |     freopen("output.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~