This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
constexpr int maxn = 1e5+10; | |
std::vector<int> g[maxn]; | |
struct Par { | |
int tam, qtd; | |
bool operator>(const Par& o) const { return tam > o.tam; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
constexpr int maxn = 2e5+10; | |
std::vector<int> g[maxn]; | |
int ans; | |
int max(int a, int b) { return a > b ? a : b; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
constexpr int maxn = 5e3 + 10; | |
std::vector<int> g[maxn]; | |
int dist[maxn][maxn], s; | |
int cnt[maxn], ans = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
using ll = long long; | |
using pii = pair<int, int>; | |
using vi = vector<int>; | |
#define pb push_back | |
#define ff first | |
#define ss second | |
#define sz(a) ((int)(a).size()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Node | |
{ | |
vector<pii> pref, suf; | |
long long ans; | |
}; | |
Node tree[4*maxn]; | |
Node combine(Node l, Node r) { | |
Node ret; | |
ret.ans = l.ans + r.ans; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Node | |
{ | |
vector<pair<int,int>> pref, suf; | |
int gcd_td; // MDC do intervalo completo | |
}; | |
int gcd(int a, int b) {return !b?a:gcd(b, a%b);} | |
Node combine(Node l, Node r) { | |
Node ret; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
constexpr int maxn = 510, maxk = 30; | |
char s[maxn], pos[maxn][maxk], ans[maxn]; | |
int main() { | |
int n, m, k; scanf("%d %d %d", &n, &m, &k); | |
scanf(" %s", s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
int main() { | |
int n, c, s; scanf("%d %d %d", &n, &c, &s); | |
int ans = 0, pos = 0; | |
--s; // 0-indexamos | |
if(s == 0) ++ans; | |
for(int i = 0; i < c; i++) { | |
int v; scanf("%d", &v); | |
pos = (pos + v + n) % n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
int main() { | |
int n, c, s; scanf("%d %d %d", &n, &c, &s); | |
int ans = 0, pos = 1; | |
if(s == 1) ++ans; | |
for(int i = 0; i < c; i++) { | |
int v; scanf("%d", &v); | |
pos += v; | |
if(pos == 0) pos = n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int P, A, L; | |
cin >> P >> A >> L; | |
if(P > 500) { | |
cout << "pandemilson\n"; | |
} else if(A > 500) { | |
cout << "alcoolgelson\n"; |
NewerOlder