제출 #1061431

#제출 시각아이디문제언어결과실행 시간메모리
1061431Halym2007서열 (APIO23_sequence)C++17
0 / 100
64 ms19812 KiB
#include <bits/stdc++.h> //#include "sequence.h" using namespace std; #define ll long long #define sz size() #define ff first #define ss second #define pb push_back #define pii pair <int, int> const int N = 5e5 + 5; int a[N], st[N], n, val[N], sana[N]; int sequence(int N, vector<int> A) { n = N; for (int i = 0; i < n; ++i) { a[i] = A[i]; } int jogap = 0; int bir = 0, iki = 0, uc = 0; for (int i = 0; i < n; ++i) { if (a[i] == 1) { bir++; } else if (a[i] == 2) { iki++; } else uc++; pii orta; orta.ff = i / 2 + 1; orta.ss = (i + 1) / 2 + 1; if (bir >= orta.ff) { jogap = max (jogap, bir); } else if (bir + iki >= orta.ff) { jogap = max (jogap, iki); } else { jogap = max (jogap, uc); } } } //int main() { // freopen ("input.txt", "r", stdin); // int N; // assert(1 == scanf("%d", &N)); // // std::vector<int> A(N); // for (int i = 0; i < N; ++i) { // assert(1 == scanf("%d", &A[i])); // } // int result = sequence(N, A); // printf("%d\n", result); // return 0; //}

컴파일 시 표준 에러 (stderr) 메시지

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^
#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...