Submission #1089404

#TimeUsernameProblemLanguageResultExecution timeMemory
1089404Mike_VuMeteors (POI11_met)C++14
24 / 100
2 ms604 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double dou; #define pii pair<int, int> #define fi first #define se second #define pb push_back #define BITj(x, j) (((x)>>(j))&1) #define MASK(x) (1LL<<(x)) template<typename T> bool maximize(T &x, const T &y) { if (x < y) {x = y; return 1;} return 0; } template<typename T> bool minimize(T &x, const T &y) { if (x > y) {x = y; return 1;} return 0; } const int maxn = 1005; int n, m, k; int o[maxn], ans[maxn]; ll goal[maxn]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #define name "task" if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".ans", "w", stdout); } cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> o[i]; } for (int i = 1; i <= n; i++) { cin >> goal[i]; } memset(ans, -1, sizeof(ans)); cin >> k; for (int t = 1; t <= k; t++) { int l, r; ll val; cin >> l >> r >> val; if (l <= r) { for (int i = l; i <= r; i++) { goal[o[i]] -= val; } } else { for (int i = 1; i <= r; i++) { goal[o[i]] -= val; } for (int i = l; i <= m; i++) { goal[o[i]] -= val; } } //check for (int i = 1; i <= n; i++) { if (goal[i] <= 0 && ans[i] == -1) ans[i] = t; } } for (int i = 1; i <= n; i++) { if (ans[i] == -1) cout << "NIE"; else cout << ans[i]; cout << "\n"; } }

Compilation message (stderr)

met.cpp: In function 'int main()':
met.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen(name".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
met.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(name".ans", "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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...