제출 #170822

#제출 시각아이디문제언어결과실행 시간메모리
170822davitmarg거래 (IZhO13_trading)C++17
100 / 100
563 ms45936 KiB
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <set> #include <queue> #include <iomanip> #include <bitset> #include <stack> #include <cassert> #include <iterator> #include <fstream> #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(), v.end() using namespace std; const int N = 300005; int n, m; vector<int> add[N], rem[N]; multiset<int> s; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { add[i].PB(-i); rem[i].PB(-i); } while (m--) { int l, r, x; scanf("%d%d%d", &l, &r, &x); add[l].PB(x - l); rem[r].PB(x - l); } for (int i = 1; i <= n; i++) { for (int j = 0; j < add[i].size(); j++) s.insert(add[i][j]); printf("%d ", i + (*s.rbegin())); for (int j = 0; j < rem[i].size(); j++) s.erase(s.find(rem[i][j])); } cout << endl; return 0; } /* 2 2 0 3 */

컴파일 시 표준 에러 (stderr) 메시지

trading.cpp: In function 'int main()':
trading.cpp:49:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < add[i].size(); j++)
                         ~~^~~~~~~~~~~~~~~
trading.cpp:52:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < rem[i].size(); j++)
                         ~~^~~~~~~~~~~~~~~
trading.cpp:43:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &l, &r, &x);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...