# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
93936 | 2019-01-13T12:43:59 Z | zeyad49 | Teams (CEOI11_tea) | Java 11 | 2500 ms | 147632 KB |
import java.io.*; import java.util.*; class tea{ public static void main(String[] args) throws IOException { Scanner sc=new Scanner(); PrintWriter out=new PrintWriter(System.out); int n=sc.nextInt(); int []a=new int[n]; Integer[]indices=new Integer[n]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); indices[i]=i; } Arrays.sort(indices,Comparator.comparingInt(i->-a[i])); int min=0; ArrayList<Integer>[]lists=new ArrayList[n]; int rem=0; for(int i=0;i<n;i++) { int idx=indices[i]; if(rem==0) { if(n-i>=a[i]) { rem=a[idx]-1; lists[min]=new ArrayList(); lists[min++].add(idx+1); } else lists[min-1].add(idx+1); } else { rem--; lists[min-1].add(idx+1); } } out.println(min); for(int i=0;i<min;i++) { out.print(lists[i].size()); for(int x:lists[i]) { out.print(" "); out.print(x); } out.println(); } out.close(); } static class Scanner { BufferedReader br; StringTokenizer st; Scanner(){ br=new BufferedReader(new InputStreamReader(System.in)); } Scanner(String fileName) throws FileNotFoundException{ br=new BufferedReader(new FileReader(fileName)); } String next() throws IOException { while(st==null || !st.hasMoreTokens()) st=new StringTokenizer(br.readLine()); return st.nextToken(); } String nextLine() throws IOException { return br.readLine(); } int nextInt() throws IOException{ return Integer.parseInt(next()); } long nextLong() throws NumberFormatException, IOException { return Long.parseLong(next()); } double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(next()); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 192 ms | 15828 KB | Output is correct |
2 | Correct | 186 ms | 15656 KB | Output is correct |
3 | Incorrect | 188 ms | 15244 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 205 ms | 15472 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 195 ms | 15740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 269 ms | 17312 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 270 ms | 17136 KB | Output is correct |
2 | Incorrect | 262 ms | 16896 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 594 ms | 37516 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 613 ms | 39200 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2071 ms | 124956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2687 ms | 147632 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2568 ms | 146700 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |