Submission #181455


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    void calc()
    {
        string[] st = splitLine(6, 6);
        int txa = getInt(st[0], 0, 1000);
        int tya = getInt(st[1], 0, 1000);
        int txb = getInt(st[2], 0, 1000);
        int tyb = getInt(st[3], 0, 1000);
        int T = getInt(st[4], 1, 50);
        int V = getInt(st[5], 1, 100);

        if (hypot(txa - txb, tya - tyb) > T * T * V * V) myon("takahashikun is too slow");

        int n = getIntLine(1, 1000);
        bool ret = false;

        double eps = 1e-12;

        for (int i = 0; i < n; i++)
        {
            st = splitLine(2, 2);
            int x = getInt(st[0], 0, 1000);
            int y = getInt(st[1], 0, 1000);
            double dist = Math.Sqrt(hypot(txa - x, tya - y)) + Math.Sqrt(hypot(txb - x, tyb - y));
            if (dist - eps < T * V) ret = true;
        }


        if (ret) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }

    int hypot(int a, int b)
    {
        return a * a + b * b;
    }

    //swap
    void swap<T>(ref T a, ref T b)
    {
        T c = a;
        a = b;
        b = c;
    }

    void myon(string s)
    {
        throw new Exception(s);
    }

    int getInt(string s, int min, int max)
    {
        int ret = int.Parse(s);
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }

    int getIntLine(int min, int max)
    {
        int ret = int.Parse(Console.ReadLine());
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }

    double getDouble(string s, double min, double max)
    {
        double ret = double.Parse(s);
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }

    double getDoubleLine(double min, double max)
    {
        double ret = double.Parse(Console.ReadLine());
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }

    string getString(string s, int min, int max)
    {
        if (s.Length < min) throw new Exception("low");
        if (s.Length > max) throw new Exception("high");
        return s;
    }

    string getStringLine(int min, int max)
    {
        string s = Console.ReadLine();
        if (s.Length < min) throw new Exception("low");
        if (s.Length > max) throw new Exception("high");
        return s;
    }

    string[] splitLine(int min, int max)
    {
        string[] ret = Console.ReadLine().Split(' ');
        if (ret.Length < min || ret.Length > max) throw new Exception("wrong length");
        return ret;
    }
}

Submission Info

Submission Time
Task C - 浮気調査
User chokudai
Language C# (Mono 2.10.8.1)
Score 100
Code Size 3003 Byte
Status AC
Exec Time 140 ms
Memory 7628 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 31
Set Name Test Cases
All test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt
Case Name Status Exec Time Memory
sample_01.txt AC 121 ms 7384 KB
sample_02.txt AC 122 ms 7380 KB
sample_03.txt AC 126 ms 7376 KB
sample_04.txt AC 122 ms 7376 KB
test_01.txt AC 125 ms 7504 KB
test_02.txt AC 125 ms 7508 KB
test_03.txt AC 124 ms 7504 KB
test_04.txt AC 122 ms 7428 KB
test_05.txt AC 123 ms 7500 KB
test_06.txt AC 123 ms 7376 KB
test_07.txt AC 124 ms 7504 KB
test_08.txt AC 124 ms 7560 KB
test_09.txt AC 125 ms 7544 KB
test_10.txt AC 127 ms 7504 KB
test_11.txt AC 122 ms 7380 KB
test_12.txt AC 123 ms 7380 KB
test_13.txt AC 124 ms 7560 KB
test_14.txt AC 124 ms 7504 KB
test_15.txt AC 122 ms 7380 KB
test_16.txt AC 123 ms 7428 KB
test_17.txt AC 122 ms 7428 KB
test_18.txt AC 121 ms 7380 KB
test_19.txt AC 140 ms 7556 KB
test_20.txt AC 124 ms 7552 KB
test_21.txt AC 124 ms 7560 KB
test_22.txt AC 120 ms 7448 KB
test_23.txt AC 123 ms 7380 KB
test_24.txt AC 124 ms 7384 KB
test_25.txt AC 125 ms 7628 KB
test_26.txt AC 124 ms 7540 KB
test_27.txt AC 125 ms 7500 KB
test_28.txt AC 123 ms 7468 KB
test_29.txt AC 123 ms 7380 KB
test_30.txt AC 121 ms 7380 KB
test_31.txt AC 123 ms 7428 KB