Submission #1068146

#TimeUsernameProblemLanguageResultExecution timeMemory
1068146AlphaBruhSoccer Stadium (IOI23_soccer)C++17
25 / 100
245 ms39812 KiB
#include "soccer.h" #include<bits/stdc++.h> using namespace std; #define P pair<int,int> int tot=0; P emprg(vector<int>x){ P ret; int cnt=0,fst=x.size(),lst=-1; for(int i=0;i<x.size();i++){ if(x[i]==0){ cnt++; fst=min(fst,i); lst=max(lst,i); } } tot+=cnt; if(lst==-1) return{fst,lst}; if(lst-fst+1 == cnt){ ret.first=fst; ret.second=lst; return ret; } ret.first=-2; return ret; } int rla(P prf, P nxt){ if(prf.first == nxt.first && prf.second == nxt.second) return 0; if (prf.first <= nxt.first && prf.second >= nxt.second) return -1; if(prf.first >= nxt.first && prf.second <= nxt.second) return 1; return -2; } int biggest_stadium(int N, std::vector<std::vector<int>> F) { tot=0; vector<P>allr; for(int i=0;i<N;i++){ P get(emprg(F[i])); if(get.first==-2) return 0; if(get.second==-1 && allr.empty()) continue; allr.push_back(get); } P prf=allr[0]; bool inc=1; for(int i=1;i<allr.size();i++){ int x=rla(prf,allr[i]); if(x==-1) inc=0; else if(x==1 && inc==0) return 0; prf=allr[i]; } for(int i=0;i<allr.size();i++){ for(int j=0;j<i;j++){ if(rla(allr[i],allr[j])==-2) return 0; } } return tot; }

Compilation message (stderr)

soccer.cpp: In function 'std::pair<int, int> emprg(std::vector<int>)':
soccer.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i=0;i<x.size();i++){
      |                 ~^~~~~~~~~
soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:44:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for(int i=1;i<allr.size();i++){
      |                 ~^~~~~~~~~~~~
soccer.cpp:50:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for(int i=0;i<allr.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...