Submission #78928

#TimeUsernameProblemLanguageResultExecution timeMemory
78928ekremBulldozer (JOI17_bulldozer)C++98
0 / 100
63 ms504 KiB
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define N 1000005 using namespace std; typedef long long ll; int n, x[N], y[N], z[N]; ll ans; map < double , ll > :: iterator it; int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d",&n); for(int i = 1; i <= n; i++) scanf("%d %d %d",x + i, y + i, z + i); for(int i = 1; i <= n; i++) for(int j = i + 1; j <= n; j++){ if(x[i] == x[j]) continue; map < double , ll > h; double a = (double)(y[i] - y[j])/(double)(x[i] - x[j]); double b = -1, c = -x[i]*a + y[i]; double bol = sqrt(a*a + b*b); for(int k = 1; k <= n; k++){ double uz = (a*x[k] + b*y[k] + c)/bol; h[uz] += z[k]; } ll top = 0; for(it = h.begin(); it != h.end(); it++){ top += it->nd; top = max(0ll, top); ans = max(ans, top); } } cout << ans << endl; return 0; }

Compilation message (stderr)

bulldozer.cpp: In function 'int main()':
bulldozer.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
bulldozer.cpp:19:8: 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, z + i);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...