# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
712739 |
2023-03-19T16:22:29 Z |
Gerardo_vega |
Poi (IOI09_poi) |
Java 11 |
|
139 ms |
12352 KB |
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
/**
*
* @author Gerardo S
*/
class participant {
int Id;
int Points;
int Resolved;
int[] ProblemsResolved;
public participant(int id, int points, int resolved, int nProblems){
Id=id;
Points=points;
Resolved=resolved;
ProblemsResolved=new int[nProblems];
}
}
class POI {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int nproblems=in.nextInt();
int philipId=in.nextInt();
participant[] p=new participant[n];
int[] problemsRecount=new int[nproblems];
for (int i = 0; i < n; i++) {
p[i]=new participant(i+1,0,0,nproblems);
for (int j = 0; j < nproblems; j++) {
int isResolved=in.nextInt();
if(isResolved==1){
problemsRecount[j]++;
p[i].ProblemsResolved[j]=1;
}
p[i].Resolved++;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < nproblems; j++) {
if(p[i].ProblemsResolved[j]==1){
p[i].Points+=n-problemsRecount[j];
}
}
}
Comparator<participant> comparadorPorEdad = new Comparator<participant>() {
@Override
public int compare(participant persona1, participant persona2) {
if (persona1.Points>=persona2.Points) {
if(persona1.Points>persona2.Points){
return -1;
}else{
//en este punto, sabemos que tienen los mismos puntos.
if(persona1.Resolved>persona2.Resolved){
return -1;
}else{
if(persona1.Resolved==persona2.Resolved){
if(persona1.Id<persona2.Id){
return -1;
}else{
return 1;
}
}else{
if(persona1.Resolved<persona2.Resolved){
return 1;
}else{
return -1;
}
}
}
}
}
return 1;
}
};
Arrays.sort(p, comparadorPorEdad);
for (int i = 0; i < p.length; i++) {
if(p[i].Id==philipId){
System.out.println(p[i].Points+" "+(i+1));
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
134 ms |
12200 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
134 ms |
12216 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
135 ms |
12264 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
130 ms |
12068 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
134 ms |
12088 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
128 ms |
12228 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
132 ms |
12152 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
128 ms |
12064 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
130 ms |
12112 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
139 ms |
11988 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
131 ms |
11972 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
130 ms |
12016 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
131 ms |
12352 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
138 ms |
12308 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
131 ms |
12284 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
131 ms |
12144 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
135 ms |
12248 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
131 ms |
12112 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
138 ms |
12168 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
134 ms |
12124 KB |
Execution failed because the return code was nonzero |