-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI089.java
More file actions
33 lines (31 loc) · 1.08 KB
/
I089.java
File metadata and controls
33 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package levelB;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
public class I089 {
public static void main(String[] args) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int N=Integer.parseInt(br.readLine());
int wolf[]=new int[N+1];
for(int i=0;i<N;i++)
wolf[i+1]=Integer.parseInt(br.readLine());
br.close();
for(int i=1;i<N;i++){
for(int j=i+1;j<=N;j++){
int a[]=new int[N+1];
Arrays.fill(a,1);
a[i]=-1;a[j]=-1;
ArrayList<Integer> lie=new ArrayList<>();
for(int k=1;k<=N;k++)
if(wolf[k]*a[Math.abs(wolf[k])]<0)
lie.add(k);
if(lie.size()==2&&a[lie.get(0)]+a[lie.get(1)]==0){
System.out.print(i+" "+j);
return;
}
}
}
System.out.println("No Solution");
}
}