Submission #145373

#TimeUsernameProblemLanguageResultExecution timeMemory
145373dolphingarlicJOI 문장 (JOI14_ho_t1)C++14
0 / 100
2 ms504 KiB
#include <bits/stdc++.h> #pragma GCC Optimize("O3") #define FOR(i, x, y) for (int i = x; i < y; i++) #define MOD 1000000007 typedef long long ll; using namespace std; int main() { iostream::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> alt_sequences = {0, 0}; int prev = 0, len = 0; FOR(i, 0, n) { int curr; cin >> curr; if (curr == prev) { alt_sequences.push_back(len); len = 0; } len++; prev = curr; } alt_sequences.push_back(len); int ans = 0; FOR(i, 0, alt_sequences.size() - 2) ans = max(ans, alt_sequences[i] + alt_sequences[i + 1] + alt_sequences[i + 2]); cout << ans << '\n'; return 0; }

Compilation message (stderr)

2014_ho_t1.cpp:2:0: warning: ignoring #pragma GCC Optimize [-Wunknown-pragmas]
 #pragma GCC Optimize("O3")
 
2014_ho_t1.cpp: In function 'int main()':
2014_ho_t1.cpp:3:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define FOR(i, x, y) for (int i = x; i < y; i++)
2014_ho_t1.cpp:29:9:
     FOR(i, 0, alt_sequences.size() - 2)
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
2014_ho_t1.cpp:29:5: note: in expansion of macro 'FOR'
     FOR(i, 0, alt_sequences.size() - 2)
     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...