Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:只用125msIn Reply To:只用125ms Posted by:xiaodaiyang at 2022-12-20 00:01:43 #include<iostream> #include<stdio.h> using namespace std; int vis[1000005]; int main() { int n; cin >> n; while (n--){ int a, b; scanf("%d%d", &a, &b); if (vis[a] < b)vis[a] = b; } for (int i = 1; i < 1000005; i++){ if (vis[i]) { printf("%d ", i); int k = vis[i]; for (int j = i + 1; j <= k; j++) if (vis[j] > k)k = vis[j]; printf("%d\n", k); i = k; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator