Submission #140158

# Submission time Handle Problem Language Result Execution time Memory
140158 2019-08-02T07:57:46 Z aminra Popeala (CEOI16_popeala) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAXN = (int)55;
const int MAXT = (int)2e5 + 3;
const ll infint = (int)1e9 + 3;
const int MOD = (int)1e9 + 7;
const ll inf = (ll)1e18 + 3;
int N, T, S;
int P[MAXT];
char R[MAXN][MAXT];
int sp[MAXT];
lint dp[MAXN][MAXT];
lint seg[MAXN][MAXT];
vector<int> wro[MAXN];
int ch[MAXT][MAXN];
 
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
 
	cin >> N >> T >> S;
	for(int i = 1; i <= T; i++) cin >> P[i];
	for(int i = 0; i < N; i++) cin >> R[i];
 
	for(int i = 1; i <= T; i++) sp[i] = sp[i - 1] + P[i];
	for(int i = 0; i < N; i++) {
		wro[i].push_back(0);
		for(int j = 0; j < T; j++) if(R[i][j] == '0') wro[i].push_back(j + 1);
	}
	for(int i = 1; i <= S; i++) dp[i][0] = LINF;
	for(int i = 1; i <= T; i++) dp[0][i] = LINF;
	for(int j = 1; j <= T; j++) {
		for(int k = 0; k < N; k++) ch[j][k] = *prev(upper_bound(wro[k].begin(), wro[k].end(), j));
		ch[j][N] = 0;
		ch[j][N + 1] = j;
		sort(ch[j], ch[j] + N + 2);
	}
	for(int i = 1; i <= S; i++) {
		for(int j = 0; j <= N; j++) for(int k = 0; k < T; k++) seg[j][k] = dp[i - 1][k] - j * sp[k];
		for(int j = 1; j <= T; j++) dp[i][j] = LINF;
		for(int j = 0; j <= N; j++) {
			deque<pli> dq;
			ch[0][j + 1] = 0;
			for(int k = 1; k <= T; k++) {
				for(int l = ch[k - 1][j + 1]; l < ch[k][j + 1]; l++) {
					while(!dq.empty() && dq.back().fi > seg[j][l]) dq.pop_back();
					dq.push_back(make_pair(seg[j][l], l));
				}
				while(!dq.empty() && dq.front().se < ch[k][j]) dq.pop_front();
				if(!dq.empty()) dp[i][k] = min(dp[i][k], dq.front().fi + sp[k] * j);
			}
		}
	}
 
	for(int i = 1; i <= S; i++) cout << dp[i][T] << "\n";
	return 0;
}

Compilation message

popeala.cpp:14:1: error: 'lint' does not name a type; did you mean 'uint'?
 lint dp[MAXN][MAXT];
 ^~~~
 uint
popeala.cpp:15:1: error: 'lint' does not name a type; did you mean 'uint'?
 lint seg[MAXN][MAXT];
 ^~~~
 uint
popeala.cpp: In function 'int main()':
popeala.cpp:31:30: error: 'dp' was not declared in this scope
  for(int i = 1; i <= S; i++) dp[i][0] = LINF;
                              ^~
popeala.cpp:31:30: note: suggested alternative: 'sp'
  for(int i = 1; i <= S; i++) dp[i][0] = LINF;
                              ^~
                              sp
popeala.cpp:31:41: error: 'LINF' was not declared in this scope
  for(int i = 1; i <= S; i++) dp[i][0] = LINF;
                                         ^~~~
popeala.cpp:31:41: note: suggested alternative: 'SING'
  for(int i = 1; i <= S; i++) dp[i][0] = LINF;
                                         ^~~~
                                         SING
popeala.cpp:32:30: error: 'dp' was not declared in this scope
  for(int i = 1; i <= T; i++) dp[0][i] = LINF;
                              ^~
popeala.cpp:32:30: note: suggested alternative: 'sp'
  for(int i = 1; i <= T; i++) dp[0][i] = LINF;
                              ^~
                              sp
popeala.cpp:32:41: error: 'LINF' was not declared in this scope
  for(int i = 1; i <= T; i++) dp[0][i] = LINF;
                                         ^~~~
popeala.cpp:32:41: note: suggested alternative: 'SING'
  for(int i = 1; i <= T; i++) dp[0][i] = LINF;
                                         ^~~~
                                         SING
popeala.cpp:40:58: error: 'seg' was not declared in this scope
   for(int j = 0; j <= N; j++) for(int k = 0; k < T; k++) seg[j][k] = dp[i - 1][k] - j * sp[k];
                                                          ^~~
popeala.cpp:40:70: error: 'dp' was not declared in this scope
   for(int j = 0; j <= N; j++) for(int k = 0; k < T; k++) seg[j][k] = dp[i - 1][k] - j * sp[k];
                                                                      ^~
popeala.cpp:40:70: note: suggested alternative: 'sp'
   for(int j = 0; j <= N; j++) for(int k = 0; k < T; k++) seg[j][k] = dp[i - 1][k] - j * sp[k];
                                                                      ^~
                                                                      sp
popeala.cpp:41:31: error: 'dp' was not declared in this scope
   for(int j = 1; j <= T; j++) dp[i][j] = LINF;
                               ^~
popeala.cpp:41:31: note: suggested alternative: 'sp'
   for(int j = 1; j <= T; j++) dp[i][j] = LINF;
                               ^~
                               sp
popeala.cpp:41:42: error: 'LINF' was not declared in this scope
   for(int j = 1; j <= T; j++) dp[i][j] = LINF;
                                          ^~~~
popeala.cpp:41:42: note: suggested alternative: 'SING'
   for(int j = 1; j <= T; j++) dp[i][j] = LINF;
                                          ^~~~
                                          SING
popeala.cpp:43:10: error: 'pli' was not declared in this scope
    deque<pli> dq;
          ^~~
popeala.cpp:43:13: error: template argument 1 is invalid
    deque<pli> dq;
             ^
popeala.cpp:43:13: error: template argument 2 is invalid
popeala.cpp:47:16: error: request for member 'empty' in 'dq', which is of non-class type 'int'
      while(!dq.empty() && dq.back().fi > seg[j][l]) dq.pop_back();
                ^~~~~
popeala.cpp:47:30: error: request for member 'back' in 'dq', which is of non-class type 'int'
      while(!dq.empty() && dq.back().fi > seg[j][l]) dq.pop_back();
                              ^~~~
popeala.cpp:47:42: error: 'seg' was not declared in this scope
      while(!dq.empty() && dq.back().fi > seg[j][l]) dq.pop_back();
                                          ^~~
popeala.cpp:47:56: error: request for member 'pop_back' in 'dq', which is of non-class type 'int'
      while(!dq.empty() && dq.back().fi > seg[j][l]) dq.pop_back();
                                                        ^~~~~~~~
popeala.cpp:48:9: error: request for member 'push_back' in 'dq', which is of non-class type 'int'
      dq.push_back(make_pair(seg[j][l], l));
         ^~~~~~~~~
popeala.cpp:48:29: error: 'seg' was not declared in this scope
      dq.push_back(make_pair(seg[j][l], l));
                             ^~~
popeala.cpp:50:15: error: request for member 'empty' in 'dq', which is of non-class type 'int'
     while(!dq.empty() && dq.front().se < ch[k][j]) dq.pop_front();
               ^~~~~
popeala.cpp:50:29: error: request for member 'front' in 'dq', which is of non-class type 'int'
     while(!dq.empty() && dq.front().se < ch[k][j]) dq.pop_front();
                             ^~~~~
popeala.cpp:50:55: error: request for member 'pop_front' in 'dq', which is of non-class type 'int'
     while(!dq.empty() && dq.front().se < ch[k][j]) dq.pop_front();
                                                       ^~~~~~~~~
popeala.cpp:51:12: error: request for member 'empty' in 'dq', which is of non-class type 'int'
     if(!dq.empty()) dp[i][k] = min(dp[i][k], dq.front().fi + sp[k] * j);
            ^~~~~
popeala.cpp:51:21: error: 'dp' was not declared in this scope
     if(!dq.empty()) dp[i][k] = min(dp[i][k], dq.front().fi + sp[k] * j);
                     ^~
popeala.cpp:51:21: note: suggested alternative: 'dq'
     if(!dq.empty()) dp[i][k] = min(dp[i][k], dq.front().fi + sp[k] * j);
                     ^~
                     dq
popeala.cpp:51:49: error: request for member 'front' in 'dq', which is of non-class type 'int'
     if(!dq.empty()) dp[i][k] = min(dp[i][k], dq.front().fi + sp[k] * j);
                                                 ^~~~~
popeala.cpp:56:38: error: 'dp' was not declared in this scope
  for(int i = 1; i <= S; i++) cout << dp[i][T] << "\n";
                                      ^~
popeala.cpp:56:38: note: suggested alternative: 'sp'
  for(int i = 1; i <= S; i++) cout << dp[i][T] << "\n";
                                      ^~
                                      sp