Submission #344065

# Submission time Handle Problem Language Result Execution time Memory
344065 2021-01-05T05:31:22 Z beksultan04 Meetings (JOI19_meetings) C++14
17 / 100
2000 ms 6764 KB
#include "meetings.h"
//#include "grader.cpp"
#include <bits/stdc++.h>

#define ll long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
using namespace std;
bool vis[2001],voobshe[2001];
void Solve(int N) {
    int x = Query(0, 1, 2);
    if (N == 3){
        if (x == 0){
            Bridge(0,1);
            Bridge(0,2);
        }
        else if (x == 1){
            Bridge(1,2);
            Bridge(0,1);
        }
        else {
            Bridge(0,2);
            Bridge(1,2);
        }
        ret ;
    }
    int y = 1,i,j,cnt=0,k;
//    if (x == 1)y = 0;
//    vis[x]=1;
//    vis[y]=1;
//    while (1){
//        for (i=0;i<N;++i){
//            if (vis[i])continue;
//            int s = Query(x,y,i);
//            if (s != x && s != y && voobshe[s] == 0){
//                y = s;
//                for (j=0;j<N;++j)
//                    vis[j]=0;
//                vis[x]=1;
//                vis[y]=1;
//            }
//        }
//        cout <<x<<" "<<y<<"\n";
//        voobshe[x]=1;
//        x = y;
//        while (voobshe[y] || x == y){
//            y++;
//            y %= N;
//        }
//                vis[x]=1;
//                vis[y]=1;
//        OK
//    }


    map <pair<pii,int>,int > mp;
    for (i=0;i<N;++i){
        for (j=i+1;j<N;++j){
            vis[i]=1;vis[j]=1;

            bool f=1;
            for (k=0;k<N;++k){
                if (vis[k])continue;
                int a = i,b = j,c = k;
                /// our sort -_0
                int s ;
                if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);
                if (mp.count({{a,b},c})==0){
                    s = Query(i,j,k);
                    mp[{{a,b},c}] = s;
                }
                else s = mp[{{a,b},c}];

                if (s != i && s != j){
                    f=0;
                    break;
                }
                vis[k]=1;
            }
            if (f){
                Bridge(i, j);
            }
            for (k=0;k<N;++k)vis[k] = 0;
        }
    }

}

Compilation message

meetings.cpp: In function 'void Solve(int)':
meetings.cpp:77:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   77 |                 if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);
      |                 ^~
meetings.cpp:77:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   77 |                 if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);
      |                                     ^~
meetings.cpp:37:9: warning: unused variable 'y' [-Wunused-variable]
   37 |     int y = 1,i,j,cnt=0,k;
      |         ^
meetings.cpp:37:19: warning: unused variable 'cnt' [-Wunused-variable]
   37 |     int y = 1,i,j,cnt=0,k;
      |                   ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 6 ms 620 KB Output is correct
15 Correct 4 ms 620 KB Output is correct
16 Correct 4 ms 620 KB Output is correct
17 Correct 5 ms 620 KB Output is correct
18 Correct 4 ms 620 KB Output is correct
19 Correct 3 ms 620 KB Output is correct
20 Correct 3 ms 620 KB Output is correct
21 Correct 3 ms 620 KB Output is correct
22 Correct 3 ms 620 KB Output is correct
23 Correct 5 ms 620 KB Output is correct
24 Correct 9 ms 876 KB Output is correct
25 Correct 10 ms 876 KB Output is correct
26 Correct 25 ms 1644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 6 ms 620 KB Output is correct
15 Correct 4 ms 620 KB Output is correct
16 Correct 4 ms 620 KB Output is correct
17 Correct 5 ms 620 KB Output is correct
18 Correct 4 ms 620 KB Output is correct
19 Correct 3 ms 620 KB Output is correct
20 Correct 3 ms 620 KB Output is correct
21 Correct 3 ms 620 KB Output is correct
22 Correct 3 ms 620 KB Output is correct
23 Correct 5 ms 620 KB Output is correct
24 Correct 9 ms 876 KB Output is correct
25 Correct 10 ms 876 KB Output is correct
26 Correct 25 ms 1644 KB Output is correct
27 Incorrect 389 ms 6764 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 5844 KB Time limit exceeded
2 Halted 0 ms 0 KB -