Submission #260429

# Submission time Handle Problem Language Result Execution time Memory
260429 2020-08-10T08:55:22 Z stefantaga Building Skyscrapers (CEOI19_skyscrapers) C++14
8 / 100
45 ms 1280 KB
#include <bits/stdc++.h>

using namespace std;
int dl[]={1,1,1,0,0,-1,-1,-1};
int dc[]={-1,0,1,-1,1,1,-1,0};
int n,t,i,sol[150005],nr,fr[150005],j;
pair <int,int> loc,b;
queue <int> q;
struct wow
{
    int x,y;
}v[150005];
int main()
{
    #ifdef HOME
    ifstream cin("date.in");
    ofstream cout("date.out");
    #endif // HOME
    cin>>n;
    cin>>t;
    for (i=1;i<=n;i++)
    {
        cin>>v[i].x>>v[i].y;
    }
    if (t==1)
    {
        q.push(1);
        sol[++nr]=1;
        fr[1]=1;
        while (!q.empty())
        {
            loc={v[q.front()].x,v[q.front()].y};
            q.pop();
            for (i=0;i<8;i++)
            {
                b.first=loc.first+dl[i];
                b.second=loc.second+dc[i];
                for (j=1;j<=n;j++)
                {
                    if (b.first==v[j].x&&b.second==v[j].y&&fr[j]==0)
                    {
                        sol[++nr]=j;
                        fr[j]=1;
                        q.push(j);
                    }
                }
            }
        }
        for (j=1;j<=n;j++)
        {
            if (fr[j]==0)
            {
                cout<<"NO";
                return 0;
            }
        }
        cout<<"YES"<<'\n';
        for (i=1;i<=n;i++)
        {
            cout<<sol[i]<<'\n';
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB ans=YES N=1
2 Correct 1 ms 384 KB ans=YES N=4
3 Correct 1 ms 384 KB ans=NO N=4
4 Correct 1 ms 384 KB ans=YES N=5
5 Correct 1 ms 328 KB ans=YES N=9
6 Correct 1 ms 384 KB ans=YES N=5
7 Correct 1 ms 384 KB ans=NO N=9
8 Correct 1 ms 384 KB ans=NO N=10
9 Correct 1 ms 384 KB ans=YES N=10
10 Correct 0 ms 384 KB ans=YES N=10
11 Correct 1 ms 384 KB ans=YES N=10
12 Correct 0 ms 384 KB ans=YES N=9
13 Correct 1 ms 384 KB ans=YES N=9
14 Correct 1 ms 384 KB ans=YES N=8
15 Correct 1 ms 384 KB ans=YES N=8
16 Correct 0 ms 384 KB ans=NO N=2
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB ans=YES N=1
2 Correct 1 ms 384 KB ans=YES N=4
3 Correct 1 ms 384 KB ans=NO N=4
4 Correct 1 ms 384 KB ans=YES N=5
5 Correct 1 ms 328 KB ans=YES N=9
6 Correct 1 ms 384 KB ans=YES N=5
7 Correct 1 ms 384 KB ans=NO N=9
8 Correct 1 ms 384 KB ans=NO N=10
9 Correct 1 ms 384 KB ans=YES N=10
10 Correct 0 ms 384 KB ans=YES N=10
11 Correct 1 ms 384 KB ans=YES N=10
12 Correct 0 ms 384 KB ans=YES N=9
13 Correct 1 ms 384 KB ans=YES N=9
14 Correct 1 ms 384 KB ans=YES N=8
15 Correct 1 ms 384 KB ans=YES N=8
16 Correct 0 ms 384 KB ans=NO N=2
17 Correct 0 ms 384 KB ans=YES N=17
18 Correct 0 ms 384 KB ans=YES N=25
19 Correct 1 ms 384 KB ans=YES N=100
20 Correct 2 ms 384 KB ans=YES N=185
21 Correct 0 ms 384 KB ans=NO N=174
22 Correct 1 ms 360 KB ans=YES N=90
23 Correct 1 ms 384 KB ans=YES N=63
24 Correct 1 ms 384 KB ans=YES N=87
25 Correct 2 ms 384 KB ans=YES N=183
26 Correct 2 ms 304 KB ans=YES N=188
27 Correct 2 ms 384 KB ans=YES N=183
28 Correct 2 ms 384 KB ans=YES N=189
29 Correct 2 ms 384 KB ans=YES N=200
30 Correct 2 ms 384 KB ans=YES N=190
31 Correct 2 ms 384 KB ans=YES N=187
32 Incorrect 2 ms 384 KB Added cell 68 (136264791,-282023883) not reachable from infinity
33 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB ans=YES N=1
2 Correct 1 ms 384 KB ans=YES N=4
3 Correct 1 ms 384 KB ans=NO N=4
4 Correct 1 ms 384 KB ans=YES N=5
5 Correct 1 ms 328 KB ans=YES N=9
6 Correct 1 ms 384 KB ans=YES N=5
7 Correct 1 ms 384 KB ans=NO N=9
8 Correct 1 ms 384 KB ans=NO N=10
9 Correct 1 ms 384 KB ans=YES N=10
10 Correct 0 ms 384 KB ans=YES N=10
11 Correct 1 ms 384 KB ans=YES N=10
12 Correct 0 ms 384 KB ans=YES N=9
13 Correct 1 ms 384 KB ans=YES N=9
14 Correct 1 ms 384 KB ans=YES N=8
15 Correct 1 ms 384 KB ans=YES N=8
16 Correct 0 ms 384 KB ans=NO N=2
17 Correct 0 ms 384 KB ans=YES N=17
18 Correct 0 ms 384 KB ans=YES N=25
19 Correct 1 ms 384 KB ans=YES N=100
20 Correct 2 ms 384 KB ans=YES N=185
21 Correct 0 ms 384 KB ans=NO N=174
22 Correct 1 ms 360 KB ans=YES N=90
23 Correct 1 ms 384 KB ans=YES N=63
24 Correct 1 ms 384 KB ans=YES N=87
25 Correct 2 ms 384 KB ans=YES N=183
26 Correct 2 ms 304 KB ans=YES N=188
27 Correct 2 ms 384 KB ans=YES N=183
28 Correct 2 ms 384 KB ans=YES N=189
29 Correct 2 ms 384 KB ans=YES N=200
30 Correct 2 ms 384 KB ans=YES N=190
31 Correct 2 ms 384 KB ans=YES N=187
32 Incorrect 2 ms 384 KB Added cell 68 (136264791,-282023883) not reachable from infinity
33 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB ans=YES N=1
2 Correct 1 ms 384 KB ans=YES N=4
3 Correct 1 ms 384 KB ans=NO N=4
4 Correct 1 ms 384 KB ans=YES N=5
5 Correct 1 ms 328 KB ans=YES N=9
6 Correct 1 ms 384 KB ans=YES N=5
7 Correct 1 ms 384 KB ans=NO N=9
8 Correct 1 ms 384 KB ans=NO N=10
9 Correct 1 ms 384 KB ans=YES N=10
10 Correct 0 ms 384 KB ans=YES N=10
11 Correct 1 ms 384 KB ans=YES N=10
12 Correct 0 ms 384 KB ans=YES N=9
13 Correct 1 ms 384 KB ans=YES N=9
14 Correct 1 ms 384 KB ans=YES N=8
15 Correct 1 ms 384 KB ans=YES N=8
16 Correct 0 ms 384 KB ans=NO N=2
17 Correct 0 ms 384 KB ans=YES N=17
18 Correct 0 ms 384 KB ans=YES N=25
19 Correct 1 ms 384 KB ans=YES N=100
20 Correct 2 ms 384 KB ans=YES N=185
21 Correct 0 ms 384 KB ans=NO N=174
22 Correct 1 ms 360 KB ans=YES N=90
23 Correct 1 ms 384 KB ans=YES N=63
24 Correct 1 ms 384 KB ans=YES N=87
25 Correct 2 ms 384 KB ans=YES N=183
26 Correct 2 ms 304 KB ans=YES N=188
27 Correct 2 ms 384 KB ans=YES N=183
28 Correct 2 ms 384 KB ans=YES N=189
29 Correct 2 ms 384 KB ans=YES N=200
30 Correct 2 ms 384 KB ans=YES N=190
31 Correct 2 ms 384 KB ans=YES N=187
32 Incorrect 2 ms 384 KB Added cell 68 (136264791,-282023883) not reachable from infinity
33 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1280 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -