답안 #574265

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574265 2022-06-08T09:12:04 Z hoainiem Džumbus (COCI19_dzumbus) C++14
0 / 110
2 ms 340 KB
#include <bits/stdc++.h>
//#pragma GCC target("popcnt")
#define fi first
#define se second
#define lc id<<1
#define rc id<<1^1
const long long inf = 1e18;
#define nmax 1008
double begintime, endtime;

using namespace std;
inline void CALC_TIME()
{
    endtime = clock();
    cout << "\nexecution time : " << (endtime - begintime + 1) / 1000 << " s";
}
typedef pair<int, int> pii;
int n, m, u, v, a[nmax];
bool ck[nmax];
vector<int> l[nmax];
void dfs(int x, int pre)
{
    assert(!ck[x]);
    ck[x] = true;
    for (int tmp : l[x])
        if (tmp != pre)
            dfs(tmp, x);
}
int main()
{
    begintime = clock();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("file.inp", "r", stdin);
    freopen("file.out", "w", stdout);
    #endif
    memset(ck, false, sizeof(ck));
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    while (m--)
    {
        cin >> u >> v;
        l[u].push_back(v);
        l[v].push_back(u);
    }
    for (int i = 1; i <= n; i++)
        if (!ck[i])
            dfs(i, i);
    return 0;
}

Compilation message

dzumbus.cpp: In function 'int main()':
dzumbus.cpp:36:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |     freopen("file.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
dzumbus.cpp:37:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     freopen("file.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -