Submission #1285613

#TimeUsernameProblemLanguageResultExecution timeMemory
1285613tarek4241Poi (IOI09_poi)C++20
Compilation error
0 ms0 KiB
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int N = Integer.parseInt(st.nextToken());
        int T = Integer.parseInt(st.nextToken());
        int P = Integer.parseInt(st.nextToken())-1;

        int[][] solved = new int[N][T];
        int[]pvalue=new int[T];
        for (int k = 0; k < N; k++) {
            st = new StringTokenizer(br.readLine());
            for (int t = 0; t < T; t++) {
                solved[k][t] = Integer.parseInt(st.nextToken());
            }
        }


        for (int t = 0; t < T; t++) {
            int zeros = 0;

            for (int k = 0; k < N; k++) {
                if (solved[k][t] == 0) {
                    zeros++;
                }
            }
            pvalue[t]=zeros;
        }
        List<Integer>arl=new ArrayList<>();
        int score=0;

        for (int k = 0; k < N; k++) {
           int scoreSum=0;
            for (int t = 0; t < T; t++) {
                if(solved[k][t]==1){
                    scoreSum+=pvalue[t];
                }
            }
            if(k==P){
                score=scoreSum;
            }
            arl.add(scoreSum);
        }
        Collections.sort(arl);


        int rank=-1;
        for(int i=arl.size()-1;i>=0;i--){
            if(score == arl.get(i)){
                rank=i+1;
            }
        }
        System.out.println(score+" "+rank);



    }
}

Compilation message (stderr)

poi.cpp:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
poi.cpp:1:1: note: C++20 'import' only available with '-fmodules-ts', which is not yet enabled with '-std=c++20'
poi.cpp:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
poi.cpp:2:1: note: C++20 'import' only available with '-fmodules-ts', which is not yet enabled with '-std=c++20'
poi.cpp:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~