Submission #240285

# Submission time Handle Problem Language Result Execution time Memory
240285 2020-06-19T06:31:27 Z qwerty2142427 덩치 (KOI13_body) C++14
0 / 18
5 ms 384 KB
#include<stdio.h>
#include<stdlib.h>
const int INT_SIZE = 4;
const int POINTER_SIZE = 4;
const int WEIGHT = 0;
const int HEIGHT = 1;
const int RANK = 2;

int main(){
	int n = 0;
	int tmp_weight = 0, tmp_height = 0;
	int **array;
	scanf("%d", &n);
	array = (int **)malloc(POINTER_SIZE * n + 1);
	(int *)malloc(INT_SIZE * 3);
	for(int i = 0; i < n; i++){
		array[i] = (int *)malloc(INT_SIZE * 3);
		scanf("%d %d", &tmp_weight, &tmp_height);
		array[i][WEIGHT] = tmp_weight;
		array[i][HEIGHT] = tmp_height;
		array[i][RANK] = 1;
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if((array[i][WEIGHT] < array[j][WEIGHT]) && (array[i][HEIGHT] < array[j][HEIGHT])){
				array[i][RANK]++;
			}
		}
	}
	for(int i = 0; i < n - 1; i++){
		printf("%d ", array[i][RANK]);
	}
	printf("%d", array[n - 1][RANK]);
	
	return 0;
}

Compilation message

bb.cpp: In function 'int main()':
bb.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
bb.cpp:15:2: warning: ignoring return value of 'void* malloc(size_t)', declared with attribute warn_unused_result [-Wunused-result]
  (int *)malloc(INT_SIZE * 3);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bb.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &tmp_weight, &tmp_height);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 4 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -