제출 #937821

#제출 시각아이디문제언어결과실행 시간메모리
937821danikoynov팀들 (IOI15_teams)C++14
컴파일 에러
0 ms0 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 10; struct segment { int l, r; segment(int _l = 0, int _r = 0) { l = _l; r = _r; } }; int n; segment s[maxn]; void init(int N, int A[], int B[]) { n = N; for (int i = 1; i <= n; i ++) s[i] = segment(A[i - 1], B[i - 1]); } struct event { int x, t, id; event(int _x = 0, int _t = 0, int _id = 0) { x = _x; t = _t; id = _id; } }; bool cmp_event(event e1, event e2) { if (e1.x != e2.x) return e1.x < e2.x; return e1.t < e2.t; } int dp[maxn]; int zeta(int j, int k) { int cnt = 0; for (int i = 1; i <= n; i ++) { if (s[i].l <= j && s[i].r >= j) continue; if (s[i].l <= k && s[i].r >= k) cnt ++; } return cnt; } int when_better(int j, int k, ll diff) { int lf = k, rf = n; while(lf <= rf) { int mf = (lf + rf) / 2; if (zeta(j, mf) - zeta(k, mf) <= diff) rf = mf - 1; else lf = mf + 1; } return lf; } int can(int M, int K[]) { for (int i = 0; i < M; i ++) { dp[i] = 0; } sort(K, K + M); deque < int > dq; for (int i = 0; i < M; i ++) { while(dq.size() > 2) { int sz = dq.size(); if (when_better(dq[sz - 2], dq)) } dp[i] = zeta(0, K[i]) - K[i]; for (int j = 0; j < i; j ++) { dp[i] = min(dp[i], dp[j] + zeta(K[j], K[i]) - K[i]); } if (dp[i] < 0) return 0; } return 1; /**vector < event > events; for (int i = 0; i < M; i ++) { events.push_back(event(K[i], 0, -1)); } for (int i = 1; i <= n; i ++) { events.push_back(event(s[i].l, -1, i)); events.push_back(event(s[i].r, 1, i)); } sort(events.begin(), events.end(), cmp_event); set < pair < int, int > > act; for (event cur : events) { if (cur.t == -1) { act.insert({s[cur.id].r, cur.id}); } else if (cur.t == 1) { if (act.find({s[cur.id].r, cur.id}) != act.end()) act.erase({s[cur.id].r, cur.id}); } else { if (act.size() < cur.x) { return 0; } for (int d = 0; d < cur.x; d ++) act.erase(act.begin()); } } return 1;*/ }

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

teams.cpp:62:31: error: 'll' has not been declared
   62 | int when_better(int j, int k, ll diff)
      |                               ^~
teams.cpp: In function 'int can(int, int*)':
teams.cpp:92:29: warning: conversion from 'std::deque<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   92 |             int sz = dq.size();
      |                      ~~~~~~~^~
teams.cpp:93:41: error: cannot convert 'std::deque<int>' to 'int'
   93 |             if (when_better(dq[sz - 2], dq))
      |                                         ^~
      |                                         |
      |                                         std::deque<int>
teams.cpp:62:28: note:   initializing argument 2 of 'int when_better(int, int, int)'
   62 | int when_better(int j, int k, ll diff)
      |                        ~~~~^
teams.cpp:94:9: error: expected primary-expression before '}' token
   94 |         }
      |         ^