Submission #284995

#TimeUsernameProblemLanguageResultExecution timeMemory
2849953zpAesthetic (NOI20_aesthetic)C++14
Compilation error
0 ms0 KiB
#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]; v[a].push_back({y,i}); v[b].push_back({y,i}); } for(int i=1;i<= n; i++) ad(i); }

Compilation message (stderr)

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:32:25: error: 'y' was not declared in this scope
   32 |         v[a].push_back({y,i});
      |                         ^
Aesthetic.cpp:32:29: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   32 |         v[a].push_back({y,i});
      |                             ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from Aesthetic.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1184 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1200 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Aesthetic.cpp:33:29: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   33 |         v[b].push_back({y,i});
      |                             ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from Aesthetic.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1184 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1200 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Aesthetic.cpp:30:35: warning: unused variable 'c' [-Wunused-variable]
   30 |         int a = ea[i], b = eb[i], c = ec[i];
      |                                   ^