Submission #167018

#TimeUsernameProblemLanguageResultExecution timeMemory
167018HideoBeautiful row (IZhO12_beauty)C++14
Compilation error
0 ms0 KiB
// Need to git gud and reach 1900+ #pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> using namespace std; #define all(s) s.begin(), s.end() #define ok puts("ok") #define ll long long #define pb push_back #define mk make_pair #define fr first #define sc second #define vi vector < int > #define pi pair < int, int > #define prev prev123 #define next next123 #define pow pow123 #define left left123 #define right right123 const int N = 2007; const int INF = 1e9 + 7; ll a[N]; int n, x, y; main(){ // If you don't know what to do, check the text box at the bottom cin >> n >> x >> y; for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); if (x == 1){ int dp[N]; dp[0] = 0; for (ll j = 45; j >= 0; j--){ ll submask = (mask | (1LL << j)), s = 0; for (int i = 1; i <= n; i++){ s = 0; dp[i] = INF; for (int l = i; l >= 1; l--){ s += a[l]; if (!(s & submask)) dp[i] = min(dp[l - 1] + 1, dp[i]); } } if (dp[i] < ) } } else { bool dp[107][107]; memset(dp, false, sizeof(dp)); dp[0][0] = true; ll mask = 0; for (ll j = 45; j >= 0; j--){ ll submask = (mask | (1LL << j)), s = 0; for (int i = 1; i <= n; i++){ dp[i][0] = false; for (int g = 1; g <= min(i, y); g++){ dp[i][g] = false; s = 0; for (int l = i; l >= g; l--){ s += a[l]; if (s & submask) continue; dp[i][g] |= dp[l - 1][g - 1]; } } } bool b = false; for (int i = x; i <= y; i++){ if (dp[n][i]){ b = true; break; } } if (b) mask = submask; } printf("%lld", (mask ^ ((1LL << 46) - 1))); } } /* Totally not inspired by BenQ's template Things you should do: 1. Look for stupid typos in code e.g 1 instead of -1 etc 2. Check if there is no infinite loops 3. "Measure twice, cut once" 4. Stay focused 6 1 3 8 1 2 1 5 4 */

Compilation message (stderr)

beauty.cpp:29:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){ // If you don't know what to do, check the text box at the bottom
      ^
beauty.cpp: In function 'int main()':
beauty.cpp:37:27: error: 'mask' was not declared in this scope
             ll submask = (mask | (1LL << j)), s = 0;
                           ^~~~
beauty.cpp:37:27: note: suggested alternative: 'main'
             ll submask = (mask | (1LL << j)), s = 0;
                           ^~~~
                           main
beauty.cpp:39:17: error: 's' was not declared in this scope
                 s = 0; dp[i] = INF;
                 ^
beauty.cpp:46:20: error: 'i' was not declared in this scope
             if (dp[i] < )
                    ^
beauty.cpp:46:25: error: expected primary-expression before ')' token
             if (dp[i] < )
                         ^
beauty.cpp:47:9: error: expected primary-expression before '}' token
         }
         ^
beauty.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &a[i]);
         ~~~~~^~~~~~~~~~~~~~~