제출 #896120

#제출 시각아이디문제언어결과실행 시간메모리
896120Macker삶의 질 (IOI10_quality)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "quality.h" //#pragma GCC optimize("Ofast") //#pragma GCC target("avx2") using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() #define ckmin(a, b) a = min(a, b) multiset<int> low, hig; void add(int x){ int m; if(low.size() == 0) m = 0; else m = *(--low.end()); if(x >= m){ hig.insert(x); while(hig.size() >= low.size()){ low.insert(*hig.begin()); hig.erase(*hig.begin()); } } else { low.insert(x); while(low.size() > hig.size() + 1) { hig.insert(*(--low.end())); low.erase(--low.end()); } } } void remove(int x){ if(low.find(x) != low.end()){ low.erase(low.find(x)); while(hig.size() >= low.size()){ low.insert(*hig.begin()); hig.erase(*hig.begin()); } } else { hig.erase(hig.find(x)); while(low.size() > hig.size() + 1) { hig.insert(*(--low.end())); low.erase(--low.end()); } } } void rectangle(int r, int c, int h, int w, vector<vector<int>> v) low.clear(); hig.clear(); int mn = INT_MAX; for (int i = 0; i < r - h; i++) { for (int j = 0; j < w; j++) { for (int k = 0; k < h; k++){ add(v[i + k][j]); } } mn = min(mn, (*--low.end())); for (int j = w; j < c; j++) { for (int k = 0; k < h; k++) { remove(v[i + k][j - w]); } for (int k = 0; k < h; k++) { add(v[i + k][j]); } mn = min(mn, (*--low.end())); } } cout << mn << endl; }

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

quality.cpp:54:5: error: expected initializer before 'low'
   54 |     low.clear();
      |     ^~~
quality.cpp:55:5: error: 'hig' does not name a type
   55 |     hig.clear();
      |     ^~~
quality.cpp:57:5: error: expected unqualified-id before 'for'
   57 |     for (int i = 0; i < r - h; i++) {
      |     ^~~
quality.cpp:57:21: error: 'i' does not name a type
   57 |     for (int i = 0; i < r - h; i++) {
      |                     ^
quality.cpp:57:32: error: 'i' does not name a type
   57 |     for (int i = 0; i < r - h; i++) {
      |                                ^
quality.cpp:77:5: error: 'cout' does not name a type
   77 |     cout << mn << endl;
      |     ^~~~
quality.cpp:78:1: error: expected declaration before '}' token
   78 | }
      | ^