Submission #72198

# Submission time Handle Problem Language Result Execution time Memory
72198 2018-08-26T05:54:38 Z 호우주의보(#2154, leehosu01) Magic Dowsing (FXCUP3_magic) C++17
100 / 100
3 ms 380 KB
#include "dowsing.h"
#include<bits/stdc++.h>
using namespace std;
vector<tuple<int,int> >V;
void FindTreasure(int N) {
    V.clear();
    for(int i=1;i<=N;i++)
        if(Detect(i,i))
            V.push_back(tie(i,i));
    if(V.size()==2)
    {
        for(int i=get<0>(V[0])-1;i<=get<0>(V[1])+1;i++)
            if(i!=get<0>(V[0])&&i!=get<0>(V[1])&&0<i&&i<=N)
            {
                if(Detect(i,get<1>(V[0])))
                    Report(get<0>(V[1]),get<1>(V[0]));
                else
                    Report(get<0>(V[0]),get<1>(V[1]));
                break;
            }
    }
    else
    {
        int rep=0;
        for(int r=1,c=2;!rep&&c<=N-1;r+=2,c+=2)
        {
            if(Detect(r,c))
            {
                for(int i=r-1;i<=r+2;i++)
                    if(i!=r&&i!=r+1&&1<=i&&i<=N)
                    {
                        if(Detect(i,c))
                            Report(r+1,c);
                        else
                            Report(r,c-1);
                        rep=1;
                        break;
                    }
            }
        }
        if(!rep)
        {
            if(Detect(1,N))
                Report(N,N);
            else
                Report(N-1,N-1);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Correct : C = 5
2 Correct 2 ms 380 KB Correct : C = 4
3 Correct 3 ms 376 KB Correct : C = 149
4 Correct 3 ms 376 KB Correct : C = 100
5 Correct 3 ms 376 KB Correct : C = 150
6 Correct 3 ms 376 KB Correct : C = 101
7 Correct 3 ms 376 KB Correct : C = 149
8 Correct 3 ms 380 KB Correct : C = 150
9 Correct 3 ms 376 KB Correct : C = 150
10 Correct 3 ms 376 KB Correct : C = 150
11 Correct 3 ms 376 KB Correct : C = 150
12 Correct 3 ms 376 KB Correct : C = 149