Is there any feature in codeforces wherein I can see the list of all virtual contests(not just the recent ones) given by me. Or if there exists any plugin that would also be helpful.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
Is there any feature in codeforces wherein I can see the list of all virtual contests(not just the recent ones) given by me. Or if there exists any plugin that would also be helpful.
Hello everyone, I wanted to know that how should one revise previously solved question on codeforces. Is it necessary to revise previously solved problems or one should keep on solving new problems? What is the best way to improve?
Hello coders, recently I came across this thing that many people who are new to CP often find it difficult to reduce the time complexity of their algorithm. They know the O(n^2) or any higher complexity algorithm but find it hard to reduce it to better time complexity. I request my fellow coders who are now comfortable in reducing the time complexity of their algorithms, to share their approaches and thought processes. This will help many people to think along those lines and eventually get better. Thanks and hope this post may help many.
Can anyone share their approach for the problem https://atcoder.jp/contests/arc101/tasks/arc101_a?
How many problems should one practice in atcoder beginner's past contests to become specialist in codeforces ? In other words in every past beginner contest how many problems should one practice to become specialist at codeforces?
Hello peeps, I'm doing codeforces for some time now. But I'm not able to rise the ladder. What should be my strategy to rise the ladder efficiently? Right now I only do codeforces problems. Should I practice from some other online judge as well.I'm struggling. Please help. Thanks in advance
In the editorial for the question https://codeforces.net/contest/1361/problem/A What is being stored by "last" and "ans" arrays ?
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ln cout<<endl;
#define vi vector<int>
#define vll vector<long long>
#define sortl(vec) sort(vec.begin(), vec.end());
#define sortr(vec) sort(vec.rbegin(), vec.rend());
#define forn(i, x, n) for(int i = x; i < int(n); i++)
#define in(vec) for(auto &it : vec) cin>>it;
#define loop(vec) for(auto &it : vec)
#define out(vec) for(auto &it : vec) cout<<it<<" ";
#define ll long long
#define mod 1000000007
#define debug(x) cout << x << endl;
#define pb push_back
#define mp make_pair
#define um unordered_map
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define dp3d(n) vector<vector<vector<ll>>>dp(n, vector<vector<ll>>(n, vector<ll>(n)));
using namespace std;
ll power(ll x, ll y, ll p) {
ll res = 1;
x = x % p;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
ll modulo(ll a, ll b) {
ll c = a % b;
return (c < 0) ? c + b : c;
}
struct cmp {
bool operator()(const pair<ll, pll> &p1, const pair<ll, pll> &p2) const {
if (p1.f == p2.f)
return p1.s.f < p2.s.f;
return p1.f > p2.f;
}
};
int main() {
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input1.txt", "r", stdin);
// for writing output to output.txt
freopen("output1.txt", "w", stdout);
#endif
fastio
ll t;
cin >> t;
while (t--) {
ll n;
cin >> n;
vll ans(n + 1);
priority_queue < pair<ll, pll>, vector<pair<ll, pll>>, cmp>pq;
pair<ll, pll> m;
pq.push(mp(n, mp(1, n)));
forn(i, 1, n + 1) {
m = pq.top();
pq.pop();
ll mid = (m.s.f + m.s.s) / 2;
ans[mid] = i;
if (mid - 1 >= m.s.f) {
pq.push(mp(mid - m.s.f, mp(m.s.f, mid - 1)));
}
if (mid + 1 <= m.s.s) {
pq.push(mp(m.s.s - mid, mp(mid + 1, m.s.s)));
}
//cout << pq.top().f << endl;
//cout << pq.top().s.f << " " << pq.top().s.s << endl;
}
forn(i, 1, n + 1)
cout << ans[i] << " ";
ln
}
return 0;
}
Here is pair structure pair<long long , pair<long, long>> I want the pair with largest first element on the top of the priority queue, if first element is same the check for the smallest first element in the second pair. But my code is doing the reverse.
I'm working out this code for the question https://codeforces.net/contest/1353/problem/D
Please help
Hello everyone, as we all know that codeforces problemset has the feature to filter problems by topics. I wish it should also have tags for a particular type of problems such as div2/C or div2/D, so that people can practice using this filter. I believe this feature could help all those who are stuck at a particular problem each time they give a contest, to overcome this barrier.
Thanks !!
Can anyone help whats wrong in my code. https://codeforces.net/contest/1055/submission/75341727
Btw it works fine on ideone.
Can someone give me a detailed solution for the problem https://codeforces.net/contest/1167/problem/C. Please don't refer the tutorial, I have already gone through it.
using namespace std;
const int N = 1000043; vector g[N];
int color{n int siz[N]; int n, m; int cc = 0;
int dfs(int x) { if(color[x]) return 0; color[x] = cc; int ans = (x < n ? 1 : 0); for(auto y : g[x]) ans += dfs(y); return ans; }
int main() { scanf("%d %d", &n, &m); for(int i = 0; i < m; i++) { int k; scanf("%d", &k); for(int j = 0; j < k; j++) { int x; scanf("%d", &x); --x; g[x].push_back(i + n); g[i + n].push_back(x); } } for(int i = 0; i < n; i++) { if(!color[i]) { cc++; siz[cc] = dfs(i); } printf("%d ", siz[color[i]]); } }
What's the use of color[N], siz[N] and cc?
Name |
---|