Created
April 26, 2016 08:21
-
-
Save PreSoichiSumi/735dc27981a3d6e79e3ecfab91206aa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Main { | |
public static boolean data[][]=new boolean[51][51]; | |
public static List<String> res=new ArrayList<>(); | |
public static int N; | |
public static int sum=0; | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
N=sc.nextInt(); | |
for(int i=0;i<51;i++){ | |
Arrays.fill(data[i], false); | |
} | |
List<Integer> list=new ArrayList<>(); | |
list.add(-1); | |
for(int i=1;i<=N;i++){ | |
int temp=sc.nextInt(); | |
list.add(temp); | |
sum+=temp; | |
data[i][i]=true; | |
} | |
//Collections.sort(list); | |
int M=sc.nextInt(); | |
int ai,bi,ci; | |
for(int i=0;i<M;i++){ | |
ai=sc.nextInt(); | |
bi=sc.nextInt(); | |
ci=sc.nextInt(); | |
if(ai==0){ | |
data[bi][ci]=true; | |
} | |
if(ai==1){ | |
if(data[bi][ci]==true){ | |
res.add(list.get(ci)+" "+list.get(ci)); | |
}else{ | |
showRes(list, bi); | |
} | |
} | |
} | |
for(String o:res) | |
System.out.println(o); | |
sc.close(); | |
} | |
public static void showRes(List<Integer> scores,int bi){ | |
int calc=sum; | |
int unknown=0; | |
for(int j=1;j<=N;j++){ | |
if(data[bi][j]==true){ | |
calc-=scores.get(j); | |
}else{ | |
unknown++; | |
} | |
} | |
int L=calc-(unknown-1)*100; | |
int H=calc; | |
if(L<0)L=0; | |
if(H>100)H=100; | |
res.add(L+" "+H); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment