Submission #69732

# Submission time Handle Problem Language Result Execution time Memory
69732 2018-08-21T12:17:50 Z Vahan Teams (IOI15_teams) C++17
0 / 100
135 ms 25884 KB
#include "teams.h"
#include<vector>
#include<algorithm>
using namespace std;
struct student{
    int l;
    int r;
};
student g[600000];
int n;
int cmp(student a,student b)
{
    if(a.r<b.r)
        return 1;
    if(a.r==b.r && a.l<b.l)
        return 1;
    return 0;
}
void init(int N, int A[], int B[]) {
    for(int i=0;i<N;i++)
        g[i]={A[i],B[i]};
    n=N;
    sort(g,g+N,cmp);
}

int can(int M, int K[]) {
    sort(K,K+M);
    int t=0;
    for(int i=0;i<n;i++)
    {
        if(g[i].l<=K[i] && g[i].r>=K[i])
            t++;
        if(t==M)
            break;
    }
    if(t==M)
        return 1;
	return 0;
}

Compilation message

teams.cpp: In function 'int can(int, int*)':
teams.cpp:36:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if(t==M)
     ^~
teams.cpp:38:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  return 0;
  ^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Incorrect 2 ms 464 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 25 ms 4964 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 26 ms 6560 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 135 ms 25884 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -