제출 #1060247

#제출 시각아이디문제언어결과실행 시간메모리
1060247anangoGift Exchange (JOI24_ho_t4)C++17
0 / 100
2544 ms10188 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int INF = 1LL<<30; signed main() { int local = 1; if (local) { // for getting input from input.txt freopen("input.txt", "r", stdin); // for writing output to output.txt freopen("output.txt", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> ar(n); for (int i=0; i<n; i++) cin >> ar[i]; vector<int> br(n); for (int i=0; i<n; i++) cin >> br[i]; /*for (int i=0; i<n; i++) { ar[i]--; br[i]--; }*/ int q; cin >> q; while (q--) { int l,r; cin >> l >> r; l--; r--; vector<pair<int,int>> endpoints; for (int i=l; i<=r; i++) { endpoints.push_back({ar[i],-(i+1)}); endpoints.push_back({br[i],(i+1)}); } sort(endpoints.begin(), endpoints.end()); int fail = 0; int ct = 0; for (int i=0; i<endpoints.size(); i++) { if (endpoints[i].second<0) ct--; else ct++; //cout << i <<" " << endpoints[i].first <<" " << endpoints[i].second <<" " << ct << endl; if (ct==0 && i!=0 && endpoints[i].second+endpoints[i-1].second==0) { fail=1; } } if (fail) { cout << "No" << endl; } else { cout << "Yes" << endl; } } }

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

Main.cpp: In function 'int main()':
Main.cpp:35:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for (int i=0; i<endpoints.size(); i++) {
      |                       ~^~~~~~~~~~~~~~~~~
Main.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen("output.txt", "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...