Submission #425446

#TimeUsernameProblemLanguageResultExecution timeMemory
425446errorgornOrchard (NOI14_orchard)C++17
25 / 25
188 ms11604 KiB
#include <cstdio> #include <vector> #include <algorithm> using namespace std; typedef pair<int,int> ii; int n,m,k,c,i,mmm; vector<int> v[155]; int sum(int a,int b){ int mm=0,cm=0; for (int x=0;x<m;x++){ i=v[b][x]-v[a][x]; cm=max(cm+i,i); mm=max(mm,cm); } return mm; } int main(){ scanf("%d%d",&n,&m); for (int x=0;x<m;x++){ v[0].push_back(0); } for (int x=1;x<=n;x++){ for (int y=0;y<m;y++){ scanf("%d",&c); i=v[x-1][y]; if (c==1) i++,k++; else i--; v[x].push_back(i); } } /*for (int x=0;x<=n;x++){ for (int y=0;y<m;y++){ printf("%d ",v[x][y]); } printf("\n"); }*/ for (int x=0;x<n;x++){ for (int y=x+1;y<=n;y++){ mmm=max(mmm,sum(x,y)); } } printf("%d\n",k-mmm); }

Compilation message (stderr)

orchard.cpp: In function 'int main()':
orchard.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  scanf("%d%d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~
orchard.cpp:24:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |    scanf("%d",&c);
      |    ~~~~~^~~~~~~~~
#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...