Submission #781236

# Submission time Handle Problem Language Result Execution time Memory
781236 2023-07-13T00:25:52 Z NK_ Pipes (CEOI15_pipes) C++17
0 / 100
741 ms 65536 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>

using namespace std;

#define nl '\n'
#define f first
#define s second
#define mp make_pair
#define pb push_back

using pi = pair<int, int>;
template<class T> using V = vector<T>;

const int eax = 12e6+5;
const int nax = 1e5+5;

int adj[eax];
int nxt[nax], start[nax];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	for(int i = 0; i < eax; i++) nxt[i] = start[i] = -1;

	int N, M; cin >> N >> M;
	int u, v;
	for(int e = 0; e < M; e++) {
		cin >> u >> v; --u, --v;

		adj[2*e] = v;
		nxt[2*e] = start[u];
		start[u] = 2*e;

		adj[2*e+1] = u;
		nxt[2*e+1] = start[v];
		start[v] = 2*e+1;	
	}

    return 0;
}


Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:24:49: warning: iteration 100005 invokes undefined behavior [-Waggressive-loop-optimizations]
   24 |  for(int i = 0; i < eax; i++) nxt[i] = start[i] = -1;
      |                                        ~~~~~~~~~^~~~
pipes.cpp:24:19: note: within this loop
   24 |  for(int i = 0; i < eax; i++) nxt[i] = start[i] = -1;
      |                 ~~^~~~~
pipes.cpp:24:49: warning: 'void* __builtin_memset(void*, int, long unsigned int)' forming offset [400020, 48000019] is out of the bounds [0, 400020] of object 'start' with type 'int [100005]' [-Warray-bounds]
   24 |  for(int i = 0; i < eax; i++) nxt[i] = start[i] = -1;
      |                                        ~~~~~~~~~^~~~
pipes.cpp:19:15: note: 'start' declared here
   19 | int nxt[nax], start[nax];
      |               ^~~~~
pipes.cpp:24:38: warning: 'void* __builtin_memset(void*, int, long unsigned int)' forming offset [400020, 48000019] is out of the bounds [0, 400020] of object 'nxt' with type 'int [100005]' [-Warray-bounds]
   24 |  for(int i = 0; i < eax; i++) nxt[i] = start[i] = -1;
      |                               ~~~~~~~^~~~~~~~~~~~~~~
pipes.cpp:19:5: note: 'nxt' declared here
   19 | int nxt[nax], start[nax];
      |     ^~~
# Verdict Execution time Memory Grader output
1 Runtime error 23 ms 47560 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 47680 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 80 ms 47564 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 138 ms 47572 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 200 ms 47600 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 228 ms 47652 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 356 ms 47572 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 455 ms 47592 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 617 ms 57632 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 741 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -