# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1849 |
2013-07-18T22:50:49 Z |
alephnull |
대표 선수 (KOI11_player) |
C++ |
|
244 ms |
4420 KB |
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int n,m;scanf("%d %d",&n,&m);
int a[n][m];
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
scanf("%d",&a[i][j]);
for(int i=0;i<n;i++)
sort(a[i],a[i]+m);
int ans=987654321;
int p[n];
for(int i=0;i<n;i++)p[i]=0;
int cnt=0;
int min=0,second=0,max=0;
while(cnt!=n*(m-1)){
if(cnt==0){
for(int i=0;i<n;i++){
if(a[i][p[i]]<a[min][p[min]])min=i;
if(a[i][p[i]]>a[max][p[max]])max=i;
}
for(int i=0;i<n;i++){
if(a[i][p[i]]<a[second][p[second]]&&a[second][p[second]]>a[min][p[min]])
second=i;
}
}
else{
if(a[min][p[min]]>a[second][p[second]]){
int tmp=second;
second=min;
min=tmp;
}
if(a[second][p[second]]>a[max][p[max]]){
int tmp=second;
second=max;
max=tmp;
}
}
//printf("%d %d\n",min,max);
if(ans>a[max][p[max]]-a[min][p[min]])ans=a[max][p[max]]-a[min][p[min]];
if(p[min]==m-1)break;
p[min]++;
cnt++;
}
printf("%d",ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
2 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
2 |
Incorrect |
7 ms |
908 KB |
Output isn't correct |
3 |
Incorrect |
17 ms |
1132 KB |
Output isn't correct |
4 |
Incorrect |
46 ms |
1616 KB |
Output isn't correct |
5 |
Incorrect |
73 ms |
1788 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
79 ms |
1956 KB |
Output isn't correct |
2 |
Incorrect |
84 ms |
1900 KB |
Output isn't correct |
3 |
Incorrect |
106 ms |
2216 KB |
Output isn't correct |
4 |
Incorrect |
120 ms |
2448 KB |
Output isn't correct |
5 |
Incorrect |
112 ms |
2640 KB |
Output isn't correct |
6 |
Incorrect |
124 ms |
2968 KB |
Output isn't correct |
7 |
Incorrect |
205 ms |
3468 KB |
Output isn't correct |
8 |
Incorrect |
199 ms |
3580 KB |
Output isn't correct |
9 |
Incorrect |
229 ms |
3976 KB |
Output isn't correct |
10 |
Incorrect |
244 ms |
4420 KB |
Output isn't correct |