I tried to submit a solution about 9 hours back. Went to sleep and then woke up hoping to see the result but stillIn queue? Why is this happening? UPD: My submission is now judged. time limit exceeded? +5 Zzyzx 10 years ago
This is my submission for 636 (Div 3) for Problem C, I made this submission during contest it's still in queue. Does it takes time?-4 charan2628 4 years ago 1 Comments (1) Write comment? imasnegi 4 years ago, # | +1 I think after contest codeforces tests each solution on...
Submission #163657473 - Codeforces int n, k; cin >> n >> k; vector<int> vis(n + 1, 0); vector<pair<int, int>> pre(n + 1, make_pair(-1, -1)); queue<int> Q; Q.push(0); vis[0] = 1; while(!Q.empty()) { int now = Q.front(); Q.pop(); for(int in = 0; ...
参考了别人的 http://codeforces.com/contest/589/submission/19431126 用的队列,更简便一点 #include<bits/stdc++.h> using namespace std; int n,m; char mapn[15][15]; char dir[10]="URDL"; int visit[15][15]; int dir_r[4]={-1,0,1,0}; //方向要与"URDL"吻合,mapn[0][0]为左上角...
insert(i); //n点不需要作为下滑的终点 vis[n] = 1; queue<int> q; q.push(n); while(!q.empty()) { int t = q.front(); q.pop(); for(auto i = --s.upper_bound(t) ; t-*i<=a[t];) { //s是所有尚未作为跳跃终点的位置集合 //--upper_bound(t)是恰好小于等于t的一个数,...
h> #include<queue> #include<string> #include<stdlib.h> #include<algorithm> using namespace std; #define N 500005 #define ll int ll n; ll c[N], maxn; inline ll lowbit(ll x){return x&(-x);} void change(ll pos, ll val){ while(pos)c[pos]=max(c[pos],val), pos-=lowbit(...
对顶堆维护中位数可见:https://www.cnblogs.com/luckyblock/p/18159496。 若有bi=0bi=0,则此时仅能修改其他位置使中位数增大,一个显然的想法是二分答案枚举增大后的中位数的值midmid,则仅需检查能否通过修改使c=⌊n−12⌋+1c=⌊n−12⌋+1个数不小于midmid。
代码语言:javascript 复制 #include<cstdio>#include<algorithm>#include<queue>#defineN100005using namespace std;int n,b;int ex[N],ey[N],d[N],s[N];queue<int>q;intmain(){scanf("%d",&n);for(int i=0;i<n;i++){scanf("%d%d",&d[i],&s[i]);if(d[i]==1)q.push(i);}while(...
The problem consists of two subproblems. The subproblems have different constraints on the input. You will get some score for the correct submission of the subproblem. The description of the subproblems follows. In subproblem B1 (3 points), the constraint 1 ≤ n ≤ 8 will hold. ...
逛submission逛到的一种解法加上了自己的理解,觉得很妙。 考虑到题目要保持两棵树且尽最大可能多地连边,不妨选一个点作为根节点,本人习惯上上并查集大的合并到小的,所以这里选择1。 遍历2到n每个点,分别检查两张图里它们与1的的连接状态。假设当前检查点为i,那么就有以下情况: ...