답안 #285001

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
285001 2020-08-28T08:49:12 Z 3zp Aesthetic (NOI20_aesthetic) C++14
0 / 100
368 ms 160660 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 3000009;
vector<pair<int,int> > v[N];
int ea[N],eb[N],ec[N],g[N],f[N];
/*
00000111111

*/
void ad(int x){
    g[x] = 1;
    for(auto E : v[x]){
        int y = E.first, i = E.second;
        if(g[y] == 1 && !f[i]) cout<<1/0;
        else if(g[y] == 1) f[i] = 0;
        if(g[y] == 0) f[i] = 1;
    }
}
int A = 0;
main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin>>ea[i]>>eb[i]>>ec[i];
    }
    for(int i = m-1; i >= 0; i--){
        int a = ea[i], b = eb[i], c = ec[i];
        if(a==b)cout<<1/0;
        v[a].push_back({b,i});
        v[b].push_back({a,i});
    }
    for(int i=1;i<= n; i++)
    ad(i);
}

Compilation message

Aesthetic.cpp: In function 'void ad(long long int)':
Aesthetic.cpp:15:39: warning: division by zero [-Wdiv-by-zero]
   15 |         if(g[y] == 1 && !f[i]) cout<<1/0;
      |                                      ~^~
Aesthetic.cpp: At global scope:
Aesthetic.cpp:21:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main(){
      |      ^
Aesthetic.cpp: In function 'int main()':
Aesthetic.cpp:31:24: warning: division by zero [-Wdiv-by-zero]
   31 |         if(a==b)cout<<1/0;
      |                       ~^~
Aesthetic.cpp:30:35: warning: unused variable 'c' [-Wunused-variable]
   30 |         int a = ea[i], b = eb[i], c = ec[i];
      |                                   ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 70784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 70784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 357 ms 99448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 368 ms 100044 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 243 ms 160660 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 243 ms 160660 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 70784 KB Output isn't correct
2 Halted 0 ms 0 KB -