Submission #4319

# Submission time Handle Problem Language Result Execution time Memory
4319 2013-09-14T04:26:42 Z kipa00 Divide into triangle (kriii1_D) C++
1 / 1
0 ms 348 KB
#include <cstdio>
#include <algorithm>
using namespace std;

class Fence {
public:
	int x, y, n;
	bool operator<(const Fence f) const {
		bool res = x < f.x;
		if (x == f.x) {
			return y < f.y;
		}
		return res;
	}
};

int main() {
	Fence arr[900];
	int N, i;
	scanf("%d", &N);
	N *= 3;
	for (i=0; i<N; ++i) {
		Fence ff;
		int x, y;
		scanf("%d %d", &x, &y);
		ff.x = x; ff.y = y;
		ff.n = i + 1;
		arr[i] = ff;
	}
	sort(arr, arr+N);
	for (i=0; i<N;) {
		printf("%d ", arr[i].n);
		if (!((++i) % 3)) {
			printf("\n");
		}
	}
	return 0;
}

Compilation message

D.cpp: In function 'int main()':
D.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
D.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   scanf("%d %d", &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct