Submission #135335

# Submission time Handle Problem Language Result Execution time Memory
135335 2019-07-24T03:35:53 Z Just_Solve_The_Problem Bulldozer (JOI17_bulldozer) C++11
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>

#define ll long long

using namespace std;

const int N = (int)2e3 + 7;

int a[N];
int x[N], y[N], w[N], pos[N];
int n;
ll pref[N];

main() {
  scanf("%d", &n);
  iota(pos, pos + n, 0);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d", &x[i], &y[i], &w[i]);
  }
  sort(pos, pos + n, [&](const int &A, const int &B){
    return x[A] < x[B];
  });
  ll mn = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (i) pref[i] = pref[i - 1];
    pref[i] += w[pos[i]];
    ans += (pref[i] - mn);
    mn = min(mn, pref[i]);
  }
  cout << ans;
}

Compilation message

bulldozer.cpp:14:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
bulldozer.cpp: In function 'int main()':
bulldozer.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
   ~~~~~^~~~~~~~~~
bulldozer.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &x[i], &y[i], &w[i]);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -