結果

問題 No.322 Geometry Dash
ユーザー threepipes_sthreepipes_s
提出日時 2015-12-22 16:56:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 638 ms / 2,000 ms
コード長 3,002 bytes
コンパイル時間 2,536 ms
コンパイル使用メモリ 92,360 KB
実行使用メモリ 53,920 KB
最終ジャッジ日時 2024-04-26 05:51:29
合計ジャッジ時間 21,942 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
37,900 KB
testcase_01 AC 78 ms
38,408 KB
testcase_02 AC 83 ms
38,408 KB
testcase_03 AC 78 ms
38,364 KB
testcase_04 AC 450 ms
52,916 KB
testcase_05 AC 515 ms
52,944 KB
testcase_06 AC 537 ms
52,532 KB
testcase_07 AC 568 ms
53,480 KB
testcase_08 AC 589 ms
52,612 KB
testcase_09 AC 523 ms
53,100 KB
testcase_10 AC 549 ms
53,408 KB
testcase_11 AC 546 ms
53,676 KB
testcase_12 AC 583 ms
53,556 KB
testcase_13 AC 594 ms
53,920 KB
testcase_14 AC 525 ms
53,176 KB
testcase_15 AC 555 ms
53,072 KB
testcase_16 AC 582 ms
53,712 KB
testcase_17 AC 588 ms
52,384 KB
testcase_18 AC 585 ms
52,856 KB
testcase_19 AC 582 ms
53,232 KB
testcase_20 AC 544 ms
53,628 KB
testcase_21 AC 608 ms
53,648 KB
testcase_22 AC 631 ms
53,076 KB
testcase_23 AC 598 ms
53,160 KB
testcase_24 AC 583 ms
52,412 KB
testcase_25 AC 595 ms
53,088 KB
testcase_26 AC 626 ms
53,584 KB
testcase_27 AC 615 ms
52,516 KB
testcase_28 AC 638 ms
53,024 KB
testcase_29 AC 581 ms
52,696 KB
testcase_30 AC 630 ms
52,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import java.util.Random;
 
public class Main {
	public static void main(String[] args) throws NumberFormatException,
	IOException {Solve solve = new Solve();solve.solve();}
}
class Solve{
	void dump(int[]a){for(int i=0;i<a.length;i++)
		System.out.print(a[i]+" ");System.out.println();};
	void solve() throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		Writer out = new Writer();
		int n = in.nextInt();
		Stage[] st = new Stage[n];
		int[] t = new int[n];
		int[] d = new int[n];
		for(int i=0; i<n; i++) t[i] = in.nextInt();
		for(int i=0; i<n; i++) d[i] = in.nextInt();
		for(int i=0; i<n; i++) st[i] = new Stage(i+1, t[i], d[i]);
		Arrays.sort(st);
		StringBuilder sb = new StringBuilder();
		Arrays.stream(st).forEach(e->sb.append(e.id+" "));
		System.out.println(sb.toString().trim());
	}
}

class Stage implements Comparable<Stage>{
	int t, d, id;
	double value;
	Stage(int id, int t, int d){
		this.id = id;
		this.t = t;
		this.d = d;
		value = (double)t/d;
	}
	@Override
	public int compareTo(Stage o) {
		return Double.compare(o.value, value);
	}
}

class MultiSet<T> extends HashMap<T, Integer>{
	@Override
	public Integer get(Object key){return containsKey(key)?super.get(key):0;}
	public void add(T key,int v){put(key,get(key)+v);}
	public void add(T key){put(key,get(key)+1);}
	public void sub(T key){
		final int num = get(key);
		if(num==1) remove(key);
		else put(key, num-1);
	}
}
class Writer extends PrintWriter{
	public Writer(String filename) throws IOException
	{super(new BufferedWriter(new FileWriter(filename)));}
	public Writer() throws IOException{super(System.out);}
}
class ContestScanner {
	private InputStreamReader reader;int c=-2;
	public ContestScanner() throws IOException 
	{reader = new InputStreamReader(System.in);}
	public ContestScanner(String filename) throws IOException
	{reader = new InputStreamReader(new FileInputStream(filename));}
	public String nextToken() throws IOException {
		StringBuilder sb = new StringBuilder();if(c==-2) c=reader.read();
		while(c!=-1&&(c==' '||c=='\t'||c=='\n'||c=='\r'))c=reader.read();
		while(c!=-1&&c!=' '&&c!='\t'&&c!='\n'&&c!='\r'){sb.appendCodePoint(c);c=reader.read();}
		return sb.toString();
	}
	public String readLine() throws IOException{
		StringBuilder sb = new StringBuilder();if(c==-2)c=reader.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.appendCodePoint(c);c=reader.read();}
		return sb.toString();
	}
	public long nextLong() throws IOException, NumberFormatException
	{return Long.parseLong(nextToken());}
	public int nextInt() throws NumberFormatException, IOException
	{return (int) nextLong();}
	public double nextDouble() throws NumberFormatException, IOException 
	{return Double.parseDouble(nextToken());}
}
0