답안 #227930

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
227930 2020-04-29T09:18:55 Z NONAME Teoretičar (COCI18_teoreticar) C++17
26 / 130
771 ms 262148 KB
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;

int a, b, m, kl[N], v[N], u[N], mx;
set <int> se[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//    in("input.txt");

    cin >> a >> b >> m;

    for (int i = 0; i < m; i++)
        cin >> v[i] >> u[i], v[i]--, u[i]--, kl[v[i]]++, kl[a + u[i]]++;

    for (int i = 0; i < a + b; i++)
        mx = max(mx, kl[i]);

    int lg = 0;

    while ((1 << lg) < mx)
        lg++;

    mx = (1 << lg);

    for (int i = 0; i < a + b; i++)
    for (int j = 1; j <= mx; j++)
        se[i].insert(j);

    cout << mx << el;

    for (int i = 0; i < m; i++) {
        for (set <int> :: iterator it = se[v[i]].begin(); it != se[v[i]].end(); it++)
            if (se[a + u[i]].find(*it) != se[a + u[i]].end()) {
                cout << (*it) << el;
                se[a + u[i]].erase(se[a + u[i]].find(*it));
                se[v[i]].erase(it);
                break;
            }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 5120 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 5248 KB Output is correct
2 Correct 8 ms 5376 KB Output is correct
3 Correct 7 ms 5120 KB Output is correct
4 Correct 7 ms 5120 KB Output is correct
5 Correct 7 ms 5120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 6272 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 41656 KB Output is correct
2 Correct 13 ms 6656 KB Output is correct
3 Correct 24 ms 12792 KB Output is correct
4 Correct 11 ms 5632 KB Output is correct
5 Correct 9 ms 5504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 13 ms 10112 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 10112 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 771 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 702 ms 258348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 683 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 561 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -