/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 7ms 1.312 MiB
#3 Wrong Answer 7ms 1.328 MiB
#4 Wrong Answer 7ms 1.324 MiB
#5 Wrong Answer 8ms 1.324 MiB
#6 Wrong Answer 8ms 1.637 MiB
#7 Wrong Answer 8ms 1.324 MiB
#8 Wrong Answer 7ms 664.0 KiB
#9 Wrong Answer 3ms 540.0 KiB
#10 Wrong Answer 3ms 540.0 KiB
#11 Wrong Answer 7ms 1.23 MiB
#12 Wrong Answer 7ms 1.328 MiB
#13 Wrong Answer 7ms 1.32 MiB
#14 Wrong Answer 7ms 1.32 MiB
#15 Accepted 7ms 1.949 MiB
#16 Wrong Answer 8ms 1.949 MiB
#17 Wrong Answer 8ms 1.945 MiB

Code

/*CODED BY mahmudulsakib2019
  DATE:-27/3/2024;TIME:-17:00 PM
  BANGALDESH , SYLHET*/
#include<bits/stdc++.h>  
using namespace std;
typedef unsigned long long  ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while(t--) {
      ll a,b=20,c,count;
      cin >> a;
      bool start=false;
      vector<ll>p(a);
      vector<ll>q,s;
      for(ll i=0;i<a;i++){
        cin >> p[i];
      }
      for(ll i=0;i<a;i++){
        if(p[i]==1){
          start = true;
          b=min(b,i);
        }
        else if(p[i]==2){
          b=20;
          start = false;
        }
        else if(p[i]==3){
          if(start){
            c=i;
            count = (c-b)+1;
            q.push_back(count);
          }

        }
      }
    if (!q.empty()) {
        auto it = max_element(q.begin(), q.end());
        cout << *it << endl;
    }
    }
    return 0;
}


Information

Submit By
Type
Submission
Problem
P1036 Perfect subarray
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-27 13:10:31
Judged At
2024-03-27 13:10:31
Judged By
Score
15
Total Time
8ms
Peak Memory
1.949 MiB