# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1850 |
2013-07-18T22:56:10 Z |
alephnull |
대표 선수 (KOI11_player) |
C++ |
|
240 ms |
4416 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[max][p[max]]){
int tmp=min;
min=max;
max=tmp;
}
if(a[min][p[min]]>a[second][p[second]]){
int tmp=second;
second=min;
min=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 |
5 ms |
908 KB |
Output isn't correct |
3 |
Incorrect |
21 ms |
1124 KB |
Output isn't correct |
4 |
Incorrect |
51 ms |
1620 KB |
Output isn't correct |
5 |
Incorrect |
67 ms |
1788 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
1948 KB |
Output isn't correct |
2 |
Incorrect |
76 ms |
1900 KB |
Output isn't correct |
3 |
Incorrect |
104 ms |
2212 KB |
Output isn't correct |
4 |
Incorrect |
98 ms |
2448 KB |
Output isn't correct |
5 |
Incorrect |
132 ms |
2644 KB |
Output isn't correct |
6 |
Incorrect |
155 ms |
2964 KB |
Output isn't correct |
7 |
Incorrect |
165 ms |
3472 KB |
Output isn't correct |
8 |
Incorrect |
214 ms |
3580 KB |
Output isn't correct |
9 |
Incorrect |
240 ms |
3972 KB |
Output isn't correct |
10 |
Incorrect |
224 ms |
4416 KB |
Output isn't correct |