CSES - Datatähti 2023 loppu - Results
Submission details
Task:Pinta-ala
Sender:Septicuss
Submission time:2023-01-21 16:57:36 +0200
Language:Java
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.11 sdetails
#20.12 sdetails
#30.11 sdetails

Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;

public class B {

    final static FastReader reader = new FastReader();
    final static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {
        
        B clazz = new B();
        
        int t = reader.nextInt();
        
        for (int i = 0; i < t; i++)
            writer.println(clazz.solve(reader.nextInt(), reader.nextInt()) ? "YES" : "NO");

        reader.close();
        writer.flush();
        writer.close();
    }
    
    boolean solve(int A, int B) {
        double sqrtA = Math.sqrt(A);
        double sqrtB = Math.sqrt(B);
        
        return !(Math.floor(sqrtB) == Math.floor(sqrtA));
        
    }

    
    
    static class FastReader {

        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastReader() {
            this.reader = new BufferedReader(new InputStreamReader(System.in));
            this.tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreElements()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {

                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException ex) {
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        BigInteger nextBigInt() {
            return new BigInteger(next());
        }

        void close() {
            try {
                reader.close(); 
            } catch (IOException ex) {
            }
            reader = null;
            tokenizer = null;
        }

    }

}

Test details

Test 1

Verdict:

input
1000
578049 731905
262997 434601
559974 650052
458543 101143
...

correct output
YES
YES
YES
NO
NO
...

user output
YES
YES
YES
YES
YES
...
Truncated

Test 2

Verdict:

input
1000
10000 9500
10000 9501
10000 9502
10000 9503
...

correct output
NO
NO
NO
NO
NO
...

user output
YES
YES
YES
YES
YES
...
Truncated

Test 3

Verdict:

input
961
1 1
1 2
1 3
1 4
...

correct output
NO
NO
NO
YES
YES
...

user output
NO
NO
NO
YES
YES
...
Truncated