제출 #1297740

#제출 시각아이디문제언어결과실행 시간메모리
1297740hiepsimauhongAliens (IOI16_aliens)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long using Maxint = int64_t; #define FOR(I, L, R) for(int I(L) ; I <= (int)R ; ++I) #define FOD(I, R, L) for(int I(R) ; I >= (int)L ; --I) #define FOA(I, A) for(auto &I : A) #define print(A,L,R) FOR(OK, L, R){if(abs(A[OK]) >= oo / 10)cout<<"- ";else cout<<A[OK]<<' ';}cout<<'\n'; #define prints(A) FOA(OK, A){cout<<OK<<' ';}cout << '\n'; #define printz(A,L,R) FOR(OK, 0, L){FOR(KO, 0, R){if(abs(A[OK][KO]) <= oo / 10)cout<<A[OK][KO]<<' ';else cout << "- ";} cout << '\n';}cout << '\n'; #define fs first #define sd second #define ii pair<int,int> #define iii pair<int, ii> #define all(A) A.begin(), A.end() #define quickly ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FILE "BUFF" const int N = 500 + 5; const int mod = 1e9 + 7; const Maxint oo = 1e18; int n, m, k; ii a[N], rl[N]; int add[N], cost[N], f[N]; Maxint dp[N][N]; /*void init(){ cin >> n >> m >> k; FOR(i, 1, n){ cin >> a[i].fs; } FOR(i, 1, n){ cin >> a[i].sd; if(a[i].fs > a[i].sd) swap(a[i].fs, a[i].sd); } }*/ void PreWork(){ sort(a + 1, a + 1 + n, [&](ii &u, ii &v){ if(u.sd == v.sd){ return u.fs > v.fs; } return u.sd < v.sd; }); stack<int> st; FOR(i, 1, n){ while(!st.empty() && a[st.top()].fs >= a[i].fs){ add[i] += add[st.top()]; st.pop(); } add[i]++; st.push(i); } n = 0; while(!st.empty()){ rl[++n] = a[st.top()]; f[n] = add[st.top()]; st.pop(); } reverse(rl + 1, rl + 1 + n); reverse(f + 1, f + 1 + n); FOR(i, 2, n){ int x = rl[i].fs; int y = rl[i - 1].sd; if(x <= y){ cost[i] = (y - x + 1) * (y - x + 1); } } } Maxint Caculate(){ memset(dp, -0x3f, sizeof dp); dp[0][0] = 0; FOR(h, 1, n){ FOR(i, 1, n){ FOR(j, 1, i){ Maxint u = rl[j].fs; Maxint v = rl[i].sd; dp[h][i] = max(dp[h][i], dp[h - 1][j - 1] - cost[j] + (v - u + 1) * (v - u + 1)); } } } return dp[k][n]; } Maxint take_photos(int _n, int _m, int _k, int r[], int c[]){ n = _n; m = _m; k = _k; FOR(i, 1, n){ a[i].fs = r[i - 1]; a[i].sd = c[i - 1]; } PreWork(); return Caculate(); } /*signed main(){ quickly if(fopen(FILE".inp", "r")){ freopen(FILE".inp", "r", stdin); freopen(FILE".out", "w", stdout); } init(); PreWork(); Caculate(); }*/

컴파일 시 표준 에러 (stderr) 메시지

aliens.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
aliens_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/cctKXlJ3.o: in function `main':
grader.cpp:(.text.startup+0xff): undefined reference to `take_photos(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status