제출 #755605

#제출 시각아이디문제언어결과실행 시간메모리
755605Nika533거래 (IZhO13_trading)C++17
100 / 100
336 ms35136 KiB
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #define int long long #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() using namespace std; int n,m,T,k; string s; void test_case() { cin>>n>>m; pair<int,int> arr[m+1]; vector<int> l[n+1]; vector<int> r[n+1]; for (int i=1; i<=m; i++) { cin>>arr[i].f>>arr[i].s; int x; cin>>x; l[arr[i].f].pb(x-arr[i].f+1); r[arr[i].s].pb(x-arr[i].f+1); } int ans=0; multiset<int> myset; for (int i=1; i<=n; i++) { for (int j=0; j<l[i].size(); j++) { myset.insert(l[i][j]); } if (myset.size()==0) { cout<<0<<" "; continue; } set<int> :: iterator it = myset.end(); it--; cout<<(*it)+i-1<<" "; for (int j=0; j<r[i].size(); j++) { myset.erase(myset.find(r[i][j])); } } cout<<endl; } main () { ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); T=1; while (T--) { test_case(); } }

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

trading.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
trading.cpp: In function 'void test_case()':
trading.cpp:28:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for (int j=0; j<l[i].size(); j++) {
      |                 ~^~~~~~~~~~~~
trading.cpp:38:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for (int j=0; j<r[i].size(); j++) {
      |                 ~^~~~~~~~~~~~
trading.cpp:25:6: warning: unused variable 'ans' [-Wunused-variable]
   25 |  int ans=0;
      |      ^~~
trading.cpp: At global scope:
trading.cpp:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   44 | main () {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...