제출 #374122

#제출 시각아이디문제언어결과실행 시간메모리
374122mariowongBigger segments (IZhO19_segments)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define push_back emplace_back #define push_front emplace_front #define pii pair<int,int> #define ff first #define ss second using namespace std; #define debug(args...) kout("[ " + string(#args) + " ]", args) void kout() { cerr << endl; } template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); } template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; } const int MAXN = 500000; int n; int a[MAXN+1]; int pre[MAXN+1]; int dp[MAXN+1]; int len[MAXN+1]; deque <pii> deq; signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i], pre[i] = pre[i-1] + a[i]; deq.push_back(0, 0); pii tmp; for (int i = 1; i <= n; i++) { while (deq.size() && pre[i]-pre[def.front().ss] >= deq.front().ff) { dp[i] = dp[deq.front().ss] + 1; tmp = deq.front(); deq.pop_front(); } deq.push_front(tmp); while (deq.size() && deq.back().ff >= pre[i]-pre[def.front().ss]) deq.pop_back(); deq.push_back(pre[i]-pre[def.front().ss], i); } cout << dp[n] << '\n'; }

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

segments.cpp: In function 'int main()':
segments.cpp:30:37: error: 'def' was not declared in this scope; did you mean 'deq'?
   30 |     while (deq.size() && pre[i]-pre[def.front().ss] >= deq.front().ff) {
      |                                     ^~~
      |                                     deq
segments.cpp:36:54: error: 'def' was not declared in this scope; did you mean 'deq'?
   36 |     while (deq.size() && deq.back().ff >= pre[i]-pre[def.front().ss])
      |                                                      ^~~
      |                                                      deq
segments.cpp:38:30: error: 'def' was not declared in this scope; did you mean 'deq'?
   38 |     deq.push_back(pre[i]-pre[def.front().ss], i);
      |                              ^~~
      |                              deq