Submission #1115057

# Submission time Handle Problem Language Result Execution time Memory
1115057 2024-11-19T23:25:30 Z lucascgar Alternating Current (BOI18_alternating) C++17
13 / 100
6 ms 3576 KB
#include <bits/stdc++.h>
 
using namespace std;
 
/*
 
*/
 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;
 
const int MAXN = 1e5+10;
 
vector<int> w[MAXN];
bool ty[MAXN];
pii cy[MAXN];
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout << fixed << setprecision(7);
 
    int n, m;
    cin >> n >> m;
  	if (n>20) return 0;
    int a, b;
    for (int i=0;i<m;i++){
        cin >> a >> b;
        cy[i] = {a, b};
    }
    int tg = (1<<m);
    for (int bt=0;bt<tg;bt++){

        for (int i=0;i<m;i++) ty[i] = ((1<<i)&bt);
        bool vl = 1;

        for (int i=1;i<=n;i++){

            bool has[2] = {0,0};

            for (int f=0;f<m;f++){
                a = cy[f].first, b = cy[f].second;
                if ((a<=b && a<=i && b >= i) || (a>b && (a<=i || b>=i))){
                    has[ty[f]]=1;
                }
            }


            if (has[0] != 1 || has[1] != 1){
                vl = 0;
                break;
            }

        }

        if (vl){
            for (int i=0;i<m;i++) cout << (int)ty[i];
            cout << '\n';
            return 0;
        }

    }
 
    cout << "impossible\n";
    return 0;
 
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3408 KB Output is correct
2 Correct 2 ms 3408 KB Output is correct
3 Correct 2 ms 3408 KB Output is correct
4 Correct 2 ms 3408 KB Output is correct
5 Correct 2 ms 3512 KB Output is correct
6 Correct 2 ms 3408 KB Output is correct
7 Correct 2 ms 3408 KB Output is correct
8 Correct 2 ms 3408 KB Output is correct
9 Correct 2 ms 3408 KB Output is correct
10 Correct 2 ms 3408 KB Output is correct
11 Correct 1 ms 3408 KB Output is correct
12 Correct 2 ms 3408 KB Output is correct
13 Correct 2 ms 3376 KB Output is correct
14 Correct 2 ms 3408 KB Output is correct
15 Correct 2 ms 3408 KB Output is correct
16 Correct 2 ms 3408 KB Output is correct
17 Correct 2 ms 3408 KB Output is correct
18 Correct 2 ms 3408 KB Output is correct
19 Correct 2 ms 3408 KB Output is correct
20 Correct 2 ms 3408 KB Output is correct
21 Correct 2 ms 3408 KB Output is correct
22 Correct 2 ms 3408 KB Output is correct
23 Correct 2 ms 3408 KB Output is correct
24 Correct 2 ms 3408 KB Output is correct
25 Correct 2 ms 3408 KB Output is correct
26 Correct 2 ms 3408 KB Output is correct
27 Correct 2 ms 3408 KB Output is correct
28 Correct 2 ms 3408 KB Output is correct
29 Correct 2 ms 3408 KB Output is correct
30 Correct 2 ms 3408 KB Output is correct
31 Correct 2 ms 3408 KB Output is correct
32 Correct 2 ms 3408 KB Output is correct
33 Correct 2 ms 3576 KB Output is correct
34 Correct 2 ms 3408 KB Output is correct
35 Correct 6 ms 3408 KB Output is correct
36 Correct 2 ms 3576 KB Output is correct
37 Correct 2 ms 3420 KB Output is correct
38 Correct 4 ms 3576 KB Output is correct
39 Correct 2 ms 3408 KB Output is correct
40 Correct 2 ms 3408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3408 KB Output is correct
2 Correct 2 ms 3408 KB Output is correct
3 Correct 2 ms 3408 KB Output is correct
4 Correct 2 ms 3408 KB Output is correct
5 Correct 2 ms 3512 KB Output is correct
6 Correct 2 ms 3408 KB Output is correct
7 Correct 2 ms 3408 KB Output is correct
8 Correct 2 ms 3408 KB Output is correct
9 Correct 2 ms 3408 KB Output is correct
10 Correct 2 ms 3408 KB Output is correct
11 Correct 1 ms 3408 KB Output is correct
12 Correct 2 ms 3408 KB Output is correct
13 Correct 2 ms 3376 KB Output is correct
14 Correct 2 ms 3408 KB Output is correct
15 Correct 2 ms 3408 KB Output is correct
16 Correct 2 ms 3408 KB Output is correct
17 Correct 2 ms 3408 KB Output is correct
18 Correct 2 ms 3408 KB Output is correct
19 Correct 2 ms 3408 KB Output is correct
20 Correct 2 ms 3408 KB Output is correct
21 Correct 2 ms 3408 KB Output is correct
22 Correct 2 ms 3408 KB Output is correct
23 Correct 2 ms 3408 KB Output is correct
24 Correct 2 ms 3408 KB Output is correct
25 Correct 2 ms 3408 KB Output is correct
26 Correct 2 ms 3408 KB Output is correct
27 Correct 2 ms 3408 KB Output is correct
28 Correct 2 ms 3408 KB Output is correct
29 Correct 2 ms 3408 KB Output is correct
30 Correct 2 ms 3408 KB Output is correct
31 Correct 2 ms 3408 KB Output is correct
32 Correct 2 ms 3408 KB Output is correct
33 Correct 2 ms 3576 KB Output is correct
34 Correct 2 ms 3408 KB Output is correct
35 Correct 6 ms 3408 KB Output is correct
36 Correct 2 ms 3576 KB Output is correct
37 Correct 2 ms 3420 KB Output is correct
38 Correct 4 ms 3576 KB Output is correct
39 Correct 2 ms 3408 KB Output is correct
40 Correct 2 ms 3408 KB Output is correct
41 Incorrect 2 ms 3408 KB Unexpected end of file - token expected
42 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3408 KB Output is correct
2 Correct 2 ms 3408 KB Output is correct
3 Correct 2 ms 3408 KB Output is correct
4 Correct 2 ms 3408 KB Output is correct
5 Correct 2 ms 3512 KB Output is correct
6 Correct 2 ms 3408 KB Output is correct
7 Correct 2 ms 3408 KB Output is correct
8 Correct 2 ms 3408 KB Output is correct
9 Correct 2 ms 3408 KB Output is correct
10 Correct 2 ms 3408 KB Output is correct
11 Correct 1 ms 3408 KB Output is correct
12 Correct 2 ms 3408 KB Output is correct
13 Correct 2 ms 3376 KB Output is correct
14 Correct 2 ms 3408 KB Output is correct
15 Correct 2 ms 3408 KB Output is correct
16 Correct 2 ms 3408 KB Output is correct
17 Correct 2 ms 3408 KB Output is correct
18 Correct 2 ms 3408 KB Output is correct
19 Correct 2 ms 3408 KB Output is correct
20 Correct 2 ms 3408 KB Output is correct
21 Correct 2 ms 3408 KB Output is correct
22 Correct 2 ms 3408 KB Output is correct
23 Correct 2 ms 3408 KB Output is correct
24 Correct 2 ms 3408 KB Output is correct
25 Correct 2 ms 3408 KB Output is correct
26 Correct 2 ms 3408 KB Output is correct
27 Correct 2 ms 3408 KB Output is correct
28 Correct 2 ms 3408 KB Output is correct
29 Correct 2 ms 3408 KB Output is correct
30 Correct 2 ms 3408 KB Output is correct
31 Correct 2 ms 3408 KB Output is correct
32 Correct 2 ms 3408 KB Output is correct
33 Correct 2 ms 3576 KB Output is correct
34 Correct 2 ms 3408 KB Output is correct
35 Correct 6 ms 3408 KB Output is correct
36 Correct 2 ms 3576 KB Output is correct
37 Correct 2 ms 3420 KB Output is correct
38 Correct 4 ms 3576 KB Output is correct
39 Correct 2 ms 3408 KB Output is correct
40 Correct 2 ms 3408 KB Output is correct
41 Incorrect 2 ms 3408 KB Unexpected end of file - token expected
42 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3408 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3408 KB Output is correct
2 Correct 2 ms 3408 KB Output is correct
3 Correct 2 ms 3408 KB Output is correct
4 Correct 2 ms 3408 KB Output is correct
5 Correct 2 ms 3512 KB Output is correct
6 Correct 2 ms 3408 KB Output is correct
7 Correct 2 ms 3408 KB Output is correct
8 Correct 2 ms 3408 KB Output is correct
9 Correct 2 ms 3408 KB Output is correct
10 Correct 2 ms 3408 KB Output is correct
11 Correct 1 ms 3408 KB Output is correct
12 Correct 2 ms 3408 KB Output is correct
13 Correct 2 ms 3376 KB Output is correct
14 Correct 2 ms 3408 KB Output is correct
15 Correct 2 ms 3408 KB Output is correct
16 Correct 2 ms 3408 KB Output is correct
17 Correct 2 ms 3408 KB Output is correct
18 Correct 2 ms 3408 KB Output is correct
19 Correct 2 ms 3408 KB Output is correct
20 Correct 2 ms 3408 KB Output is correct
21 Correct 2 ms 3408 KB Output is correct
22 Correct 2 ms 3408 KB Output is correct
23 Correct 2 ms 3408 KB Output is correct
24 Correct 2 ms 3408 KB Output is correct
25 Correct 2 ms 3408 KB Output is correct
26 Correct 2 ms 3408 KB Output is correct
27 Correct 2 ms 3408 KB Output is correct
28 Correct 2 ms 3408 KB Output is correct
29 Correct 2 ms 3408 KB Output is correct
30 Correct 2 ms 3408 KB Output is correct
31 Correct 2 ms 3408 KB Output is correct
32 Correct 2 ms 3408 KB Output is correct
33 Correct 2 ms 3576 KB Output is correct
34 Correct 2 ms 3408 KB Output is correct
35 Correct 6 ms 3408 KB Output is correct
36 Correct 2 ms 3576 KB Output is correct
37 Correct 2 ms 3420 KB Output is correct
38 Correct 4 ms 3576 KB Output is correct
39 Correct 2 ms 3408 KB Output is correct
40 Correct 2 ms 3408 KB Output is correct
41 Incorrect 2 ms 3408 KB Unexpected end of file - token expected
42 Halted 0 ms 0 KB -