답안 #781234

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
781234 2023-07-13T00:25:11 Z NK_ Pipes (CEOI15_pipes) C++17
0 / 100
749 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;
	for(int e = 0; e < M; e++) {
		int u, v; 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];
      |     ^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 47572 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 23 ms 47672 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 85 ms 47800 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 136 ms 47920 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 263 ms 47924 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 260 ms 47564 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 382 ms 48080 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 493 ms 51112 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 701 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 749 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -