Submission #88965

# Submission time Handle Problem Language Result Execution time Memory
88965 2018-12-10T07:20:06 Z tarash117 Schools (IZhO13_school) C++14
0 / 100
214 ms 5484 KB
#include<bits/stdc++.h>
using namespace std;
int used1[100001];
int used2[100001];
int main(){


  int n,m,s;
  cin>>n>>m>>s;
  int b[n+1],a[n+1];
  for(int i=1;i<=n;i++)
    cin>>a[i]>>b[i];


  int mxm=a[1],mxs=b[1],mxi=1;
  used1[1]=1;

  for(int i=2;i<=n;i++){
    if(a[i]>mxm&&used1[i]<m){
        mxm=a[i];

        used1[i]++;
        used1[mxi]--;
        mxi=i;
    }
  }

  for(int i=1;i<=n;i++)
    if(used1[i]<s&&b[i]>mxs)
        mxs=b[i];

    int mx1=mxs+mxm;

    mxs=b[1],mxm=a[1],mxi=1;

    for(int i=2;i<=n;i++){
        if(b[i]>mxs&&used2[i]<s){
            mxs=b[i];
            used2[i]++;
            used2[mxi]--;
            mxi=i;
        }
    }

    for(int i=1;i<=n;i++)
        if(used2[i]<m&&a[i]>mxm)
         mxm=a[i];

    int mx2=mxm+mxs;
    cout<<max(mx1,mx2);
  return 0;
}

Compilation message

school.cpp: In function 'int main()':
school.cpp:28:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for(int i=1;i<=n;i++)
   ^~~
school.cpp:32:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     int mx1=mxs+mxm;
     ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 2 ms 500 KB Output isn't correct
3 Incorrect 2 ms 500 KB Output isn't correct
4 Incorrect 2 ms 500 KB Output isn't correct
5 Incorrect 2 ms 628 KB Output isn't correct
6 Incorrect 0 ms 628 KB Output isn't correct
7 Incorrect 5 ms 628 KB Output isn't correct
8 Incorrect 5 ms 628 KB Output isn't correct
9 Incorrect 6 ms 628 KB Output isn't correct
10 Incorrect 5 ms 628 KB Output isn't correct
11 Incorrect 6 ms 628 KB Output isn't correct
12 Incorrect 5 ms 628 KB Output isn't correct
13 Incorrect 26 ms 876 KB Output isn't correct
14 Incorrect 57 ms 1132 KB Output isn't correct
15 Runtime error 111 ms 3268 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 129 ms 3568 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 159 ms 4204 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 171 ms 4600 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 183 ms 4868 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 214 ms 5484 KB Execution killed with signal 11 (could be triggered by violating memory limits)