제출 #305807

#제출 시각아이디문제언어결과실행 시간메모리
3058074fecta카니발 티켓 (IOI20_tickets)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define ll long long #define int ll #define ld long double #define pii pair<int, int> #define f first #define s second #define readl(_s) getline(cin, (_s)); #define boost() cin.tie(0); cin.sync_with_stdio(0) const int MN = 1505; int n, m, k, a[MN][MN], ans[MN][MN], tot, rnd[MN]; int32_t main() { boost(); cin >> n >> m >> k; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int i = 0; i < n; i++) { for (int j = m - k; j < m; j++) { //half max, half min, choose all max first then trade for loss. tot += a[i][j]; } } memset(ans, -1, sizeof(ans)); vector<pii> v; for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) { v.push_back({-a[i][j] - a[i][m - k + j], i}); //we will take the min from this row since it loses the least pts. } } sort(v.begin(), v.end(), greater<>()); for (int i = 0; i < n * k / 2; i++) tot += v[i].f, rnd[v[i].s]++; for (int i = 0; i < n; i++) { int id = 0; for (int j = 0; j < rnd[i]; j++) { ans[i][j] = id % k; id %= k; id++; } for (int j = m - 1; j > m - 1 - (k - rnd[i]); j--) { ans[i][j] = id % k; id %= k; id++; } } printf("%lld\n", tot); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) printf("%lld ", ans[i][j]); printf("\n"); } return 0; }

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

/tmp/cckh9Q3V.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccuts7sM.o:tickets.cpp:(.text.startup+0x0): first defined here
/tmp/cckh9Q3V.o: In function `main':
grader.cpp:(.text.startup+0x3b2): undefined reference to `find_maximum(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status