Submission #124441

#TimeUsernameProblemLanguageResultExecution timeMemory
124441KhalilBenGamraStrange Device (APIO19_strange_device)Java
0 / 100
5108 ms401712 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); long n = scan.nextLong(); long a = scan.nextLong(); long b = scan.nextLong(); Set<String> found = new HashSet<String>(); for (long i = 0; i < n; i++) { long f = scan.nextLong(); long l = scan.nextLong(); for (long j = f; j <= l; j++) { String xy = ((j+(j/b))%a)+ "" +(j%b); //System.out.prlongln("("+x+","+y+")"); found.add(xy); } } out.println(found.size()); out.close(); } }
#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...