Submission #957779

#TimeUsernameProblemLanguageResultExecution timeMemory
957779ALTAKEXESequence (APIO23_sequence)C++17
11 / 100
2079 ms4188 KiB
#include <bits/stdc++.h> #define ll long long #define f first #define s second using namespace std; int sequence(int N, std::vector<int> A) { ll ans = 0; for (ll i = 0; i < A.size(); i++) { ll s = 0, c = 0; for (ll j = i; j >= 0; j--) { if (A[i] == A[j]) c++; if (A[i] > A[j]) s--; if (A[i] < A[j]) s++; if (abs(s) <= c) ans = max(ans, c); } } return ans; }

Compilation message (stderr)

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:9:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for (ll i = 0; i < A.size(); i++)
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...