Submission #1146841

#TimeUsernameProblemLanguageResultExecution timeMemory
1146841gulmixKamenčići (COCI21_kamencici)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll = ll; #define all(x) x.begin(), x.end() #define oset tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ll n, k; char s[352]; ll dp[352][352][352]; ll pref[352]; ll solve(ll l, ll r, ll m){ ll res = dp[l][r][m]; if(res == -1){ ll tot = pref[n-1]; ll rtot = pref[r]; if(l)rtot -= pref[l-1]; ll ored = tot - rtot - m; if(m >= k){ res = 0; }else if(ored >= k){ res = 1; }else{ if(!solve(l+1, r, ored) || !solve(l, r-1, ored)){ res = 1; }else{ res = 0; } } } return res; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); //ifstream cin("cycle2.in"); //ofstream cout("cycle2.out"); scanf("%d%d", &n, &k); scanf("%s", s); for(int i = 0; i < 352; i++){ for(int j = 0; j < 352; j++){ for(int k = 0; k < 352; k++){ dp[i][j][k] = -1; } } } pref[0] = (s[0] == 'C'); for(int i = 1; i < n; i++){ pref[i] = pref[i-1] + (s[i] == 'C'); } if(solve(0, n-1, 0)){ puts("DA"); }else{ puts("NE"); } }

Compilation message (stderr)

Main.cpp:6:12: error: 'll' does not name a type; did you mean 'all'?
    6 | using ll = ll;
      |            ^~
      |            all
Main.cpp:10:1: error: 'll' does not name a type; did you mean 'all'?
   10 | ll n, k;
      | ^~
      | all
Main.cpp:12:1: error: 'll' does not name a type; did you mean 'all'?
   12 | ll dp[352][352][352];
      | ^~
      | all
Main.cpp:13:1: error: 'll' does not name a type; did you mean 'all'?
   13 | ll pref[352];
      | ^~
      | all
Main.cpp:15:1: error: 'll' does not name a type; did you mean 'all'?
   15 | ll solve(ll l, ll r, ll m){
      | ^~
      | all
Main.cpp: In function 'int main()':
Main.cpp:42:20: error: 'n' was not declared in this scope; did you mean 'yn'?
   42 |     scanf("%d%d", &n, &k);
      |                    ^
      |                    yn
Main.cpp:42:24: error: 'k' was not declared in this scope
   42 |     scanf("%d%d", &n, &k);
      |                        ^
Main.cpp:47:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   47 |                 dp[i][j][k] = -1;
      |                 ^~
      |                 dup
Main.cpp:51:5: error: 'pref' was not declared in this scope
   51 |     pref[0] = (s[0] == 'C');
      |     ^~~~
Main.cpp:55:8: error: 'solve' was not declared in this scope
   55 |     if(solve(0, n-1, 0)){
      |        ^~~~~
Main.cpp:43:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |     scanf("%s", s);
      |     ~~~~~^~~~~~~~~