제출 #1317769

#제출 시각아이디문제언어결과실행 시간메모리
1317769nagorn_phJelly Flavours (IOI20_jelly)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "jelly.h" using namespace std; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); reverse(a.begin(), a.end()); a.emplace_back(0); reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); b.emplace_back(0); reverse(b.begin(), b.end()); vector <pair <int, int>> v; for (int i = 1; i <= n; i++) { v.emplace_back(a[i], b[i]); } sort(v.begin(), v.end()); int ans = 0; bool visited[n + 1] = {0}; int idx = 0; for (auto [l, r] : v) { if (l <= r && x >= l) { visited[idx] = true; ans++; x -= l; } idx++; } idx = 0; for (auto [l, r] : v) { if (!visited[idx]y >= r) { ans++; y -= r; } idx++; } return ans; } /* sub 1-2 , 3: constraints , y = 0 dp[i][j][k] = max ans when we used i at a, j at b, checked up to k answer is at dp[x][y][n] sub 4: b is all equal greedy stupid again sub 5: a and b are same */

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

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:28:34: error: expected ')' before 'y'
   28 |                 if (!visited[idx]y >= r) {
      |                    ~             ^
      |                                  )