Submission #124462

#TimeUsernameProblemLanguageResultExecution timeMemory
124462KhalilBenGamraStrange Device (APIO19_strange_device)Java
0 / 100
125 ms11164 KiB
import java.util.*; import java.io.*; public class strange_device { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); int n = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); Set<String> found = new HashSet<String>(); for (int i = 0; i < n; i++) { int f = scan.nextInt(); int l = scan.nextInt(); for (int j = f; j <= l; j++) { String xy = ((j+(int)Math.floor(j/b))%a)+ "" +(j%b); //System.out.println("("+x+","+y+")"); found.add(xy); } } out.println(found.size()); out.close(); System.exit(0); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...