제출 #1248945

#제출 시각아이디문제언어결과실행 시간메모리
1248945CyanmondAliens (IOI16_aliens)C++20
12 / 100
40 ms2376 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define ALL(x) (x).begin(), (x).end() #define REP(i, l, r) for (int i = (l); i < (r); ++i) #define len(x) int(x.size()) long long take_photos(int n, int m, int K, std::vector<int> r, std::vector<int> c) { vector<pair<int, int>> pts(n); REP(i, 0, n) { if (r[i] > c[i]) { swap(r[i], c[i]); } pts[i] = make_pair(r[i], c[i]); } sort(ALL(pts)); { vector<pair<int, int>> pts2; REP(i, 0, n) { if (i != n - 1 and pts[i].first == pts[i + 1].first) { continue; } pts2.push_back(pts[i]); } pts = pts2; n = len(pts); } { vector<pair<int, int>> pts2; int mx_c = -1; REP(i, 0, n) { if (pts[i].second <= mx_c) { continue; } pts2.push_back(pts[i]); mx_c = max(mx_c, pts[i].second); } pts = pts2; n = len(pts); } vector<vector<ll>> dp(n + 1, vector<ll>(K + 1, 1ll << 60)); dp[0][0] = 0; REP(i, 1, n + 1) { REP(j, 0, i) { ll diff = pts[i - 1].second - pts[j].first + 1; ll cost = diff * diff; REP(k, 0, K) { dp[i][k + 1] = min(dp[i][k + 1], dp[j][k] + cost); } } } ll ans = 1ll << 60; REP(i, 0, K + 1) { ans = min(ans, dp[n][i]); } return ans; }

컴파일 시 표준 에러 (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
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...