码迷,mamicode.com
首页 > 其他好文 > 详细

Test

时间:2017-05-28 16:50:44      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:ase   for   put   make   main   bool   pre   round   acs   

autumn
#include<bits/stdc++.h>
using namespace std; const int maxn = 200005; int p[maxn],a[maxn],b[maxn]; bool vis[maxn]; set<pair<int,int> >s[5]; int main() { int n,m,t; scanf("%d",&n); for (int i = 0;i < n;i++) scanf("%d",&p[i]); for (int i = 0;i < n;i++) scanf("%d",&a[i]); for (int i = 0;i < n;i++) scanf("%d",&b[i]); for (int i = 0;i < n;i++) { s[a[i]].insert(make_pair(p[i],i)); s[b[i]].insert(make_pair(p[i],i)); vis[i] = true; } scanf("%d",&m); while (m--) { int ans = -1; scanf("%d",&t); while (!s[t].empty()) { int pos = (*(s[t].begin())).second; s[t].erase(s[t].begin()); if (!vis[pos]) continue; ans = p[pos]; vis[pos] = false; break; } printf("%d ",ans); } puts(" "); return 0; }



emacs
#include<bits/stdc++.h>
using namespace std; const int maxn = 200005; int p[maxn],a[maxn],b[maxn]; bool vis[maxn]; set<pair<int,int> >s[5]; int main() { int n,m,t; scanf("%d",&n); for (int i = 0;i < n;i++) scanf("%d",&p[i]); for (int i = 0;i < n;i++) scanf("%d",&a[i]); for (int i = 0;i < n;i++) scanf("%d",&b[i]); for (int i = 0;i < n;i++) { s[a[i]].insert(make_pair(p[i],i)); s[b[i]].insert(make_pair(p[i],i)); vis[i] = true; } scanf("%d",&m); while (m--) { int ans = -1; scanf("%d",&t); while (!s[t].empty()) { int pos = (*(s[t].begin())).second; s[t].erase(s[t].begin()); if (!vis[pos]) continue; ans = p[pos]; vis[pos] = false; break; } printf("%d ",ans); } puts(" "); return 0; }
 
 
colorful
#include<bits/stdc++.h>
using namespace std; const int maxn = 200005; int p[maxn],a[maxn],b[maxn]; bool vis[maxn]; set<pair<int,int> >s[5]; int main() { int n,m,t; scanf("%d",&n); for (int i = 0;i < n;i++) scanf("%d",&p[i]); for (int i = 0;i < n;i++) scanf("%d",&a[i]); for (int i = 0;i < n;i++) scanf("%d",&b[i]); for (int i = 0;i < n;i++) { s[a[i]].insert(make_pair(p[i],i)); s[b[i]].insert(make_pair(p[i],i)); vis[i] = true; } scanf("%d",&m); while (m--) { int ans = -1; scanf("%d",&t); while (!s[t].empty()) { int pos = (*(s[t].begin())).second; s[t].erase(s[t].begin()); if (!vis[pos]) continue; ans = p[pos]; vis[pos] = false; break; } printf("%d ",ans); } puts(" "); return 0; }
 
 
perldoc
#include<bits/stdc++.h>
using namespace std; const int maxn = 200005; int p[maxn],a[maxn],b[maxn]; bool vis[maxn]; set<pair<int,int> >s[5]; int main() { int n,m,t; scanf("%d",&n); for (int i = 0;i < n;i++) scanf("%d",&p[i]); for (int i = 0;i < n;i++) scanf("%d",&a[i]); for (int i = 0;i < n;i++) scanf("%d",&b[i]); for (int i = 0;i < n;i++) { s[a[i]].insert(make_pair(p[i],i)); s[b[i]].insert(make_pair(p[i],i)); vis[i] = true; } scanf("%d",&m); while (m--) { int ans = -1; scanf("%d",&t); while (!s[t].empty()) { int pos = (*(s[t].begin())).second; s[t].erase(s[t].begin()); if (!vis[pos]) continue; ans = p[pos]; vis[pos] = false; break; } printf("%d ",ans); } puts(" "); return 0; }
 
pastie
#include<bits/stdc++.h>
using namespace std; const int maxn = 200005; int p[maxn],a[maxn],b[maxn]; bool vis[maxn]; set<pair<int,int> >s[5]; int main() { int n,m,t; scanf("%d",&n); for (int i = 0;i < n;i++) scanf("%d",&p[i]); for (int i = 0;i < n;i++) scanf("%d",&a[i]); for (int i = 0;i < n;i++) scanf("%d",&b[i]); for (int i = 0;i < n;i++) { s[a[i]].insert(make_pair(p[i],i)); s[b[i]].insert(make_pair(p[i],i)); vis[i] = true; } scanf("%d",&m); while (m--) { int ans = -1; scanf("%d",&t); while (!s[t].empty()) { int pos = (*(s[t].begin())).second; s[t].erase(s[t].begin()); if (!vis[pos]) continue; ans = p[pos]; vis[pos] = false; break; } printf("%d ",ans); } puts(" "); return 0; }

Test

标签:ase   for   put   make   main   bool   pre   round   acs   

原文地址:http://www.cnblogs.com/zzy19961112/p/6915846.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!