Submission #262653

# Submission time Handle Problem Language Result Execution time Memory
262653 2020-08-13T06:32:24 Z 송준혁(#5085) Pairs (IOI07_pairs) C++17
40 / 100
3526 ms 6392 KB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

int N, L, M;
LL ans;
int X[101010], Y[101010], Z[101010];
int D[110][110][110];

int main(){
	scanf("%*d %d %d %d", &N, &L, &M);
	for (int i=1; i<=N; i++){
		scanf("%d %d %d", &X[i], &Y[i], &Z[i]);
		for (int x=max(X[i]-L, 1); x<=min(X[i]+L, M); x++){
			for (int y=max(Y[i]-L+abs(X[i]-x), 1); y<=min(Y[i]+L-abs(X[i]-x), M); y++){
				D[x][y][max(Z[i]-L+abs(X[i]-x)+abs(Y[i]-y), 1)]++;
				D[x][y][min(Z[i]+L-abs(X[i]-x)-abs(Y[i]-y), M)+1]--;
			}
		}
	}
	for (int x=1; x<=M; x++) for (int y=1; y<=M; y++) for (int z=1; z<=M; z++) D[x][y][z]+=D[x][y][z-1];
	for (int i=1; i<=N; i++) ans += D[X[i]][Y[i]][Z[i]];
	printf("%lld\n", (ans-N)/2);
	return 0;
}

Compilation message

pairs.cpp: In function 'int main()':
pairs.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |  scanf("%*d %d %d %d", &N, &L, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
pairs.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |   scanf("%d %d %d", &X[i], &Y[i], &Z[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 6392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 3200 KB Output is correct
2 Correct 39 ms 3072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 2168 KB Output is correct
2 Correct 63 ms 2168 KB Output is correct
3 Correct 72 ms 2168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 156 ms 4088 KB Output is correct
2 Correct 1569 ms 4212 KB Output is correct
3 Correct 1887 ms 4272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 920 ms 5092 KB Output is correct
2 Correct 2806 ms 5112 KB Output is correct
3 Correct 3526 ms 5156 KB Output is correct