Submission #338465

#TimeUsernameProblemLanguageResultExecution timeMemory
338465theshadow_04Bulldozer (JOI17_bulldozer)C++11
0 / 100
1 ms364 KiB
// V T An #include <bits/stdc++.h> #define Task "BULLDOZER" using namespace std; const int maxn = 2005; int n; struct data { int x, y, w; bool operator < (const data A) { return x < A.x; } } point[maxn]; long long s[maxn], ans = 0; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); if(fopen(Task".inp", "r")){ freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n; for(int i = 1; i <= n; ++ i) { int x, y, w; cin >> x >> y >> w; point[i] = {x, y, w}; } sort(point + 1, point + n + 1); for(int i = 1; i <= n; ++ i) { s[i] = s[i - 1] + point[i].w; } for(int i = 1; i <= n; ++ i) { for(int j = i + 1; j <= n; ++ j) { ans = max(ans, s[j] - s[i - 1]); } } cout << ans << "\n"; } // CHY-AKAV

Compilation message (stderr)

bulldozer.cpp: In function 'int main()':
bulldozer.cpp:24:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   24 |   freopen(Task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bulldozer.cpp:25:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   25 |   freopen(Task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...