QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96448#5160. Kebab PizzaZuqa#WA 5ms8196kbC++201.5kb2023-04-13 21:37:002023-04-13 21:37:02

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 21:37:02]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:8196kb
  • [2023-04-13 21:37:00]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define el '\n'
#define FIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
typedef unsigned long long ull;

template<typename T, typename X>
using hashTable = gp_hash_table<T, X>;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// mt19937_64 for long long
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
const int N = 1e5 + 7;
set<int> st[N];

void doWork()
{
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; ++i)
    {
        int a, b;
        cin >> a >> b;
        if(a == b)
            continue;
        st[a].insert(b);
        st[b].insert(a);
    }
    for(int i = 0; i < k; ++i)
    {
        // cout << i + 1 << st[i + 1].size() << endl;
        int cnt = 0;
        for(auto it: st[i + 1])
        {
            if(st[it].size() > 1)
                cnt++;
        }
        if(cnt > 2)
        {
            cout << "impossible";
            return;
        }
    }
    cout << "possible";
}

signed main()
{
    FIO
    int T = 1;
//    cin >> T;
    for(int i = 1; i <= T; i++)
        doWork();
}

詳細信息

Test #1:

score: 100
Accepted
time: 5ms
memory: 8140kb

input:

7 6
2 2
3 6
1 1
1 5
4 5
6 6
6 5

output:

possible

result:

ok single line: 'possible'

Test #2:

score: 0
Accepted
time: 1ms
memory: 8148kb

input:

5 5
1 3
1 5
2 3
2 5
3 4

output:

possible

result:

ok single line: 'possible'

Test #3:

score: 0
Accepted
time: 4ms
memory: 8008kb

input:

6 7
1 2
2 3
3 4
4 5
3 6
6 7

output:

impossible

result:

ok single line: 'impossible'

Test #4:

score: 0
Accepted
time: 1ms
memory: 8088kb

input:

8 4
1 1
1 2
2 1
2 2
3 3
3 4
4 3
4 4

output:

possible

result:

ok single line: 'possible'

Test #5:

score: 0
Accepted
time: 4ms
memory: 8084kb

input:

4 4
1 2
2 1
3 4
4 3

output:

possible

result:

ok single line: 'possible'

Test #6:

score: 0
Accepted
time: 1ms
memory: 8196kb

input:

5 4
1 1
1 4
2 2
2 4
3 4

output:

possible

result:

ok single line: 'possible'

Test #7:

score: -100
Wrong Answer
time: 3ms
memory: 8076kb

input:

6 4
1 1
1 4
2 2
2 4
3 3
3 4

output:

possible

result:

wrong answer 1st lines differ - expected: 'impossible', found: 'possible'