# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
16246 | eaststar | 대표 선수 (KOI11_player) | C++14 | 274 ms | 8900 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <algorithm>
using namespace std;
struct Data{
int c,p;
bool operator<(const Data&r)const{
return p<r.p;
}
}a[1000010];
int chk[1010],ans=1<<30,f=0,r=-1,flag;
int main(){
int i,j,n,m,t;
scanf("%d%d",&n,&m);
for(i=0;i<n;++i){
for(j=0;j<m;++j){
scanf("%d",&a[i*m+j].p);
a[i*m+j].c=i+1;
}
}
std::sort(a,a+n*m);
while(r<n*m-1){
if(flag==n){
ans=min(ans,a[r].p-a[f].p);
chk[a[f].c]--;
if(!chk[a[f].c])flag--;
++f;
}
else{
chk[a[++r].c]++;
if(chk[a[r].c]==1)flag++;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |