제출 #1021710

#제출 시각아이디문제언어결과실행 시간메모리
1021710lHogMonthly railway pass (LMIO18_menesinis_bilietas)C++17
0 / 100
3071 ms26452 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> veci;
typedef vector<ll> vecll;
#define mp make_pair
#define fi first
#define se second
// debug needs a semicolon !!!
#define debug(x) cerr<<# x<<" is "<<x<<'\n'
#define vec vector

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, m;
    cin >> n >> m;
    veci a[n];
    for (int i=0; i<n; i++) {
        int x;
        cin >> x;
        a[i].push_back(x);
        char USELESS;
        cin >> USELESS;
    }
    queue<int> tv;
    tv.push(0);
    bool visited[n]={1};
    while (!tv.empty()) {
        int x = tv.front();
        tv.pop();
        for (int i=0; i<a[x].size(); i++) {
            if (!visited[a[x][i]]) {
                tv.push(i);
                visited[i] = true;
            }
        }
    }
    for (int i=0; i<n; i++) {
        if (!visited[i]) {
            cout << 0;
            return 0;
        }
    }
    cout << n;
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

menesinis_bilietas.cpp: In function 'int main()':
menesinis_bilietas.cpp:35:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for (int i=0; i<a[x].size(); i++) {
      |                       ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...