Submission #1061429

#TimeUsernameProblemLanguageResultExecution timeMemory
1061429Halym2007Sequence (APIO23_sequence)C++17
Compilation error
0 ms0 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 = ({i / 2 + 1, (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; //}

Compilation message (stderr)

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:31:22: warning: left operand of comma operator has no effect [-Wunused-value]
   31 |   pii orta = ({i / 2 + 1, (i + 1) / 2 + 1});
      |                ~~~~~~^~~
sequence.cpp:31:42: error: expected ';' before '}' token
   31 |   pii orta = ({i / 2 + 1, (i + 1) / 2 + 1});
      |                                          ^
      |                                          ;
sequence.cpp:31:39: error: conversion from 'int' to non-scalar type 'std::pair<int, int>' requested
   31 |   pii orta = ({i / 2 + 1, (i + 1) / 2 + 1});
      |                           ~~~~~~~~~~~~^~~
sequence.cpp:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^