Submission #4319

#TimeUsernameProblemLanguageResultExecution timeMemory
4319kipa00Divide into triangle (kriii1_D)C++98
1 / 1
0 ms348 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...