답안 #42375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42375 2018-02-26T15:05:37 Z wasyl Baza (COCI17_baza) C++11
50 / 50
92 ms 29980 KB
#include <bits/stdc++.h>
#ifndef dbg
#define dbg(...)
#endif
#define all(x) begin(x), end(x)
#define rsz(...) resize(__VA_ARGS__)
#define psh(...) push_back(__VA_ARGS__)
#define emp(...) emplace_back(__VA_ARGS__)
#define prt(...) print(cout, __VA_ARGS__)
#define dmp(...) print(cerr, #__VA_ARGS__, '=', __VA_ARGS__)
#define dprt(...) dbg(print(cerr,__VA_ARGS__))
#define ddmp(...) dbg(dmp(__VA_ARGS__))
using namespace std;using ll=long long;
template<typename t>using V=vector<t>;
template<typename t>void print(ostream& os, const t& a){os<<a<<'\n';}
template<typename t, typename... A>void print
(ostream& os, const t& a, A&&... b){os<<a<<' ';print(os, b...);}

inline bool operator== (const V< int >& a, const V< int >& b)
{
    for (int i = 0; i < a.size(); ++i)
        if (!(a[i] == b[i] or a[i] == -1 or b[i] == -1))
            return false;
    return true;
}

int n, m, q;
V< V< int > > tb;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    tb.rsz(n, V< int >(m));
    for (auto& v : tb)
        for (int& i : v)
            cin >> i;
    
    cin >> q;
    for (int i = 0; i < q; ++i)
    {
        V< int > ilo(m);
        for (int& i : ilo)
            cin >> i;
            
        int res = 0;
        for (int i = 0; i < n; ++i)
            if (ilo == tb[i])
                ++res;
        prt(res);
    }
}

Compilation message

baza.cpp: In function 'bool operator==(V<int>&, V<int>&)':
baza.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < a.size(); ++i)
                       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 2680 KB Output is correct
2 Correct 18 ms 3560 KB Output is correct
3 Correct 46 ms 7872 KB Output is correct
4 Correct 13 ms 7872 KB Output is correct
5 Correct 56 ms 10720 KB Output is correct
6 Correct 69 ms 14852 KB Output is correct
7 Correct 92 ms 20484 KB Output is correct
8 Correct 56 ms 22640 KB Output is correct
9 Correct 29 ms 23744 KB Output is correct
10 Correct 79 ms 29980 KB Output is correct