Submission #403584

#TimeUsernameProblemLanguageResultExecution timeMemory
403584tqbfjotld레이저 센서 (KOI16_laser)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; vector<pair<int,pair<int,int> > > points; vector<int> ans[1005]; int main(){ int n; scanf("%d",&n); for (int x = 0;x<n; x++){ int a,b; scanf("%d%d",&a,&b); points.push_back({a,{x,0}}); } for (int x = 0; x<2*n; x++){ int a,b; scanf("%d%d",&a,&b); points.push_back({a,{x,1}}); } sort(points.begin(),points.end()); vector<pair<int,int> > red; vector<pair<int,int> > b; for (auto x : points){ if (x.second.second){ if (!b.empty()){ ans[b.back().second].push_back(x.second.first); b.pop_back(); } else{ red.push_back({x.first,x.second.first}); } } else{ for (int k = 0; k<2; k++){ if (!red.empty()){ ans[x.second.first].push_back(red.back().second); red.pop_back(); } else{ b.push_back({x.first,x.second.first}); } } } } for (int x = 0; x<n; x++){ printf("%d %d\n",ans[x][0],ans[x][1]); } }

Compilation message (stderr)

laser.cpp: In function 'int main()':
laser.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
laser.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d%d",&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~
laser.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%d%d",&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...