Submission #22208

#TimeUsernameProblemLanguageResultExecution timeMemory
22208내일 시험이에요 (#42)구간들 (KRIII5P_3)C++11
2 / 7
86 ms2816 KiB
#include <cstdio> #include <algorithm> #include <queue> using namespace std; typedef pair<int,int> pii; typedef long long ll; const ll mod = 1000000007; int n; pii a[101010]; priority_queue<int, vector<int>, greater<int> > pq; int c; int pow2(int x){ ll t = 2; ll r = 1; while(x){ if(x&1){ r = (r*t)%mod; } t = (t*t)%mod; x/=2; } return int(r); } int main(){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d%d",&a[i].first, &a[i].second); } sort(a,a+n); for(int i=0;i<n;i++){ if(a[i].first >= a[i].second)continue; while(!pq.empty() && pq.top() <= a[i].first){ pq.pop(); } c = (c+pow2(pq.size()))%mod; pq.push(a[i].second); } printf("0 %d\n",c); }

Compilation message (stderr)

i.cpp: In function 'int main()':
i.cpp:26:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
i.cpp:28:48: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&a[i].first, &a[i].second);
                                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...