prompt string | response string |
|---|---|
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | //package educational.round25;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
char[] s... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
int a[26], b[26];
cin >> s >> t;
for (int i = 0; i < 26; i++) {
a[i] = 0;
b[i] = 0;
}
if (s.length() < t.length()) {
for (int i = 0; i < s.length(); i++) {
if (s[i] == '?') s[i] = t[i];
}
} else {
for (int i ... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.util.*;
import java.io.*;
public class ProbD {
public static void main(String[] args) {
ProbD sol = new ProbD();
sol.start();
}
StringBuffer printstr;
String _readerstr;
BufferedReader rdr;
HashSet<Integer> debug_number_set;
int[] debug_code;
public void print(Object o){ print(o, 0); }
publi... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double EPS = 1e-9;
const int INF = 1 << 29;
int const NN = 2e5 + 5;
int cs[26], ct[26];
pair<int, pair<int, int> > p[26];
int main() {
string s, t;
cin >> s >> t;
int n = s.length(), m = t.length();
int avail = 0;
for (int i = 0; i <... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 10;
const int MAXN = 30;
char s[MAX], t[MAX], x[MAX];
int a[MAXN], b[MAXN], c[MAX];
void init() {
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
}
int main() {
while (scanf("%s%s", s, t) != EOF) {
int ls = strlen(s);
int lt = strlen(t)... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
public class D825{
void solve()
{
char[] s = ca();
char[] t = ca();
long[] alp = new long[26];
long[] hav = new long[26];
int qm = 0;
for(char c : s)
if(c != '?')
alp... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
cin >> s >> t;
vector<int> cnt(26), perSuit(26);
int qcnt = 0;
for (int i = 0; i < (((int)(s).size())); i++) {
if (s[i] == '?')
qcnt++;
else
cnt[s[i] - 'a']++;
}
for (int i = 0; i < (((int)(t).size())); i++) {
... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
string s, t;
int num_s[1005];
int num_t[1005];
int num_w[1005];
int main() {
cin >> s >> t;
for (int i = 0; i < s.size(); i++) num_s[s[i]]++;
for (int i = 0; i < t.size(); i++) num_t[t[i]]++;
int ans = 0;
while (1) {
int flag = 0;
for (int i = 'a'; i <= 'z... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
long long int all1[300], all2[300], all3[300];
int main() {
ios_base::sync_with_stdio(false);
string s1, s2;
cin >> s1 >> s2;
for (int i = 0; i < 290; ++i) {
all1[i] = 0;
all2[i] = 0;
all3[i] = 0;
}
for (int i = 0; i < s1.size(); ++i) {
all1[s1[i... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;
public class code5 {
InputStream is;
PrintWriter out;
static long mod=pow(10,9)+7;
static int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
void solve() throws Exception
{
String s=ns();
String t=ns();
if(t.length()>s.length())
{
ou... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import sys
#type(next(sys.stdin))
#tab2 = list(map(int, next(sys.stdin).split()))
# In the name of God
import sys
from collections import Counter
def retKey(ceci):
i = 0
for elem in ceci:
if d[elem] > 0:
return elem
else:
continue
return -1
s = str( next(sys.... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
long long int cnts[30], cntt[30];
long long int q;
const int N = 1e6 + 6;
char s[N], t[N];
int main() {
scanf("%s", s);
scanf("%s", t);
int n = strlen(s);
int m = strlen(t);
memset(cnts, 0, sizeof(cnts));
memset(cntt, 0, sizeof(cntt));
q = 0;
for (int i = 0;... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b;
cin >> a >> b;
vector<char> ans;
long long int cnt[27];
memset(cnt, 0, sizeof(cnt));
for (long long int i = 0; i < a.length(); i++) {
if (a[i] == '?')
cnt[26]++;
else
cnt[a[i] - 'a']++;
}
while (cnt[26] != 0) {
... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
char s[maxn], t[maxn];
int cnt[30], res[30];
int main(int argc, char const *argv[]) {
scanf("%s", s);
scanf("%s", t);
int lena = strlen(s);
int lenb = strlen(t);
if (lena < lenb) {
for (int i = 0; i < lena; i++) printf("%c", s[i] == '... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string s, t;
cin >> s >> t;
vector<int> scnt(26, 0), tcnt(26, 0);
for (char &c : s)
if (c != '?') scnt[c - 'a']++;
for (char &c : t) tcnt[c - 'a']++;
for (auto &c : s) {
... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
vector<long long> vec[200005], number;
int n, x;
long long ans;
int arr[200004];
void dfs(int i, int depth) {
arr[i] = depth;
for (int child = 0; child < vec[i].size(); ++child) {
if (!arr[vec[i][child]]) dfs(vec[i][child], depth + 1);
}
}
void numbers(long long a... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.io.*;
import java.math.*;
import java.util.*;
public class D {
final static int MOD = 1000000007;
public static void main(String[] args) throws Exception {
FastReader in = new FastReader(System.in);
StringBuilder s = new StringBuilder(in.next());
String t = in.next();
int[] list = new int[26];
... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;
public class Competitive_1 {
public static void main(String[] args) {
FastReader in = new FastReader();
String s=in.next(), t=in.next();
int replace = 0;
int freqS[] = ... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.util.PriorityQueue;
import java.util.Comparator;
import java.util.ArrayList;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
public class Main
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private Data... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.max;
public class ProblemD {
BufferedReader rd;
ProblemD() throws IOException {
rd = new BufferedReader(new InputStreamReader(System.in));
compute();
}
private vo... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
const int NSIZ = 1000010;
const int MSIZ = 1000010;
const int inf = 1010580540;
const int mxint = 2147483647;
const long long mxll = 9223372036854775807LL;
const long long prime15 = 1000000000000037LL;
const long long mod = 1000000007LL;
const long long mod9 = 1000000009LL;... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
int res = 1;
x = x % p;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
long long PO(long long a, long long n) {
long long val = 1;
for (long long... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
#pragma GCC optimize("O3")
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
const int maxn = 1e5 + 10;
const long long mod = 1e9 + 7;
long long fsp(long long a, long long b) {
long long ans = 1;
while (b) {
... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.util.*;
import java.io.*;
import java.io.FileWriter;
import java.math.BigInteger;
import java.math.BigDecimal;
// Solution
public class Main
{
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
final int[][] dirs8 = {{0,1}, {0,-1}, {-1,0}, {1,0}, ... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
long long chs[326] = {0};
cin >> s >> t;
for (long long i = 0; i < s.length(); i++) {
if (s[i] != '?') {
chs[s[i]]++;
}
}
long long p = 0;
for (long long i = 0; i < s.length(); i++) {
if (s[i] != '?') {
continu... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
double pi = 3.1415926535898;
const long long M = 1e9 + 7;
const int inf = 2e9 + 7;
const double EPS = 1e-9;
string ys = "YES\n";
string no = "NO\n";
string s, t;
int fs[50];
int ft[50];
map<char, int> ans;
int q = 0;
bool ok(int x) {
int qq = q;... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
cin >> s >> t;
int cnt = 0;
vector<int> v;
int f[30] = {0};
for (int i = 0; i < s.size(); i++) {
if (s[i] == '?')
v.push_back(i);
else
f[s[i] - 'a']++;
}
int j = 0;
for (int i = 0; j < v.size(); i = (i + 1) % t... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | from string import lowercase;
def get(s):
freq = {};
for c in lowercase:
freq[c] = 0;
freq['?'] = 0;
for c in s:
freq[c] += 1;
return freq;
def can(k):
global S,T;
r = S['?'];
for c in T:
if c == '?': continue;
d = max(k*T[c] - S[c],0);
if r < d: ... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
const long double pi = acosl(-1.0);
const int MAXN = 100005;
const long long mod = 1000000007ll;
int alp[26];
int cur[26];
void update() {
for (int i = 0; i < 26; ++i) cur[i] -= alp[i];
}
char getneed() {
for (int i = 0; i < 26; ++i)
if (cur[i] < alp[i]) {
++c... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
const pair<int, int> DIR[] = {
make_pair(1, -1), make_pair(1, 0), make_pair(1, 1), make_pair(0, 1),
make_pair(0, -1), make_pair(-1, -1), make_pair(-1, 0), make_pair(-1, 1)};
int main() {
string text, match;
cin >> text >> match;
map<char, int> text_occ;
m... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
string t;
getline(cin, s);
getline(cin, t);
vector<int> tv(26, 0);
vector<int> sv(27, 0);
vector<int> qpos;
for (size_t i = 0; i < t.length(); ++i) {
tv[t[i] - 'a']++;
}
for (size_t i = 0; i < s.length(); ++i) {
if (s[i] ==... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import java.math.BigInteger;
public class MainS
{
static MyScanner scan;
static PrintWriter pw;
static long MOD = 1_000_000_000_000L;
static long INF = 1_000_000_000_000_000_000L;
static long inf = 2_000_000_000;
public static... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | from collections import Counter
s = raw_input()
n = len(s)
#print n
t = raw_input()
arr = Counter(s)
art = Counter(t)
qs = arr['?']
low = 0
high = n
#cnt = {}\\]
while True:
if high < low:
y = low-1
break
y = (low+high)/2
su = 0
for u in art.keys():
#cnt = {}
if u != '?':
su += art[u]*y - min(art[u]*y,a... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | #include <bits/stdc++.h>
using namespace std;
const long long UNDEF = -1;
const long long INF = 1e18;
template <typename T>
inline bool chkmax(T& aa, T bb) {
return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T& aa, T bb) {
return aa > bb ? aa = bb, true : false;
}
static char stdinB... |
Problem: You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters.
Suitability of string s is calculated by following metric:
Any two letters can be swapped positions, these operations can be performed arbitrary number of times over any pair of positions. Among al... | import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static int mod = 1000000007;
static int inf = (int) 1e16;
static ArrayList<Integer>[] ad;
static int n, m;
static long[][] memo, c;
static HashSet<... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200000 + 10;
const long long INF = 1000000000 + 9;
long long n, h, w;
vector<pair<long long, long long>> v;
map<pair<long long, long long>, long long> M;
long long diag(pair<long long, long long> a) { return a.first + a.second; }
int32_t main() {
io... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import java.awt.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
import java.util.Queue;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class B implements Runnable{
// SOLUTION!!!
// HACK ME PLEASE IF YOU CA... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 10;
pair<int, pair<int, pair<int, int> > > z[MAXN];
int g[MAXN], p[MAXN], t[MAXN], ans[MAXN];
map<int, vector<int> > collide;
int main() {
ios::sync_with_stdio(false);
int k, w, h;
cin >> k >> w >> h;
for (int i = 0; i < k; i++) {
c... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
struct Node {
int pos, dir, idx;
Node(int pos, int dir, i... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
struct node {
int x, y;
} a[100100];
vector<pair<int, int> > p[300100];
int shu[300100];
bool nod[100100];
int ct[100100];
int n, w, h, t;
int main() {
scanf("%d%d%d", &n, &w, &h);
for (int i = 1; i <= n; i++) {
scanf("%d%d%d", &a[i].x, &a[i].y, &t);
if (a[i].... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fRand(double fMin, double fMax) {
double f = (double)rand() / RAND_MAX;
return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
return max... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
struct Dancer {
int g, p, t, id;
} a[100005];
int x[100005], y[100005];
int q1[100005], q2[100005];
bool cmp(Dancer &x, Dancer &y) {
if (x.t - x.p == y.t - y.p) return x.p < y.p;
return x.t - x.p < y.t - y.p;
}
int main() {
int n, w, h;
scanf("%d%d%d", &n, &w, &h)... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
long long dx[4] = {0, -1, 0, 1};
long long dy[4] = {1, 0, -1, 0};
using namespace std;
class pa3 {
public:
long long x, y, z;
pa3(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {}
bool operator<(const pa3 &p) const {
if (x != p.x) return x < p.x;
if (y != p... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
struct dancer {
int g, p, t, i;
};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, w, h, i;
cin >> n >> w >> h;
dancer dancers[n];
map<int, vector<dancer> > s;
for (i = 0; i < n; i++) {
cin >> dancers[i].g >> dancer... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
const int maxn = 1e5 + 5;
std::map<int, std::vector<int> > Reading;
struct Walk {
int p, t, dir;
int id;
} M[maxn];
int n, w, h;
int ansx[maxn], ansy[maxn];
inline bool Comp(int Alpha, int Beta) { return M[Alpha].p > M[Beta].p; }
int main() {
scanf("%d%d%d", &n, &w, &h);
for (int i = 1;... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100010, H = 500000, G = 150000;
struct cyc {
int x, num, id;
} a[maxn];
int n, x1, x2, tot, A[maxn], B[maxn], ans[maxn], anss[maxn];
bool cmp(cyc a, cyc b) {
return a.num < b.num || (a.num == b.num && a.x < b.x);
}
int main() {
scanf("%d%d%d", &n, &x1... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int n, a, b, op[N], p[N], t[N], ansx[N], ansy[N];
vector<int> vec[(N << 1) + 3];
struct Dot {
int x, y;
} dot[N];
inline void LOCAL() { freopen("1.in", "r", stdin); }
inline void read(int &x) {
x = 0;
char c = getchar();
int f = 1;
while (c <... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Compar... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
struct Range {
struct It {
int num, step;
int operator*() { return num; }
void operator++() { num += step; }
bool operator!=(const It& other) { return num != other.num; }
};
Range(int ee) : b(0), e(ee) {}
Range(int bb, int ee) : b(bb), e(ee) {}
It begin() { return {b, ... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
int ai[100005];
pair<int, int> ans[100005];
vector<tuple<int, int, int>> f[200005], t[200005];
int main() {
int n, w, h;
scanf("%d%d%d", &n, &w, &h);
for (int i = 0; i < n; i++) {
ai[i] = i;
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if (a == 1) {
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 1 16:32:00 2017
@author: strashila
"""
from sys import stdin, stdout
from itertools import product, chain, izip
from collections import defaultdict
n, w, h = [int(w) for w in stdin.readline().strip().split()]
dancers = {}
positions = []
for i in... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
template <typename T>
inline T max(T a, T b) {
return a > b ? a : b;
}
template <typename T>
inline T min(T a, T b) {
return a < b ? a : b;
}
template <typename T>
inline T abs(T a) {
return a > 0 ? a : -a;
}
template <typename T>
inline bool repr(T &a, T b) {
return a < b ? a = b, 1 : ... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
namespace FastIO {
const int SIZE = 1 << 16;
char buf[SIZE], obuf[SIZE], str[60];
int bi = SIZE, bn = SIZE, opt;
int read(char* s) {
while (bn) {
for (; bi < bn && buf[bi] <= ' '; bi++)
;
if (bi < bn) break;
bn = fread(buf, 1, SIZE, stdin);
bi = 0;
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
int N, W, H;
pair<int, int> ans[100011];
vector<pair<int, int> > hrz[100011 * 2];
vector<pair<int, int> > vrt[100011 * 2];
int main() {
if (fopen("data.in", "r")) freopen("data.in", "r", stdin);
scanf("%d", &N);
scanf("%d", &W);
scanf("%d", &H);
for (int i = 0; i ... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
vector<int> s[200005];
pair<int, int> ans[100005];
int g[100005], p[100005], t[100005];
int main() {
int n, w, h;
scanf("%d%d%d", &n, &w, &h);
for (int i = 0; i < n; i++) {
scanf("%d%d%d", &g[i], &p[i], &t[i]);
s[p[i] - t[i] + 100000].push_back(i);
}
for (... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int MAX = 112345;
const int INF = 0x3f3f3f3f;
const long long MOD = 1000000007;
int n, w, h;
int g[MAX], p[MAX], t[MAX];
map<int, vector<int> > hor, ver;
pair<int, int> ed[MAX], resp[MAX];
bool cmp1(int a, int b) { return p[a] < p[b]; }
bool cmp2(int a, int b) { retur... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int maxm = 100010;
int n, w, h, g[maxm], p[maxm], t[maxm], ansx[maxm], ansy[maxm];
vector<int> vx, vy, v[maxm << 1];
int main() {
ios_base::sync_with_stdio(0);
cin >> n >> w >> h;
for (int i = 0; i < n; ++i) {
cin >> g[i] >> p[i] >> t[i];
v[p[i] - t[i] +... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int inf = 1000000043;
const long long linf = 1LL << 62;
const long long mod7 = 1000000007;
const long long mod9 = 1000000009;
long double PI = 3.141592653589793238462643383279502884197169399375;
template <class T>
inline const T sqr(const T& x) {
return x * x;
}
lon... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int x[N], y[N], ans[N];
map<int, vector<pair<int, int> > > hor, ver;
void solve(vector<pair<int, int> > &a, vector<pair<int, int> > &b) {
sort(b.rbegin(), b.rend());
sort(a.begin(), a.end());
deque<int> temp;
vector<int> res;
for (int i = 0;... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int maxn = 100010;
const long long mod = 1e9 + 7;
const int inf = 1e9;
int n, w, h;
pair<int, int> a[maxn];
vector<pair<int, int> > X, Y;
vector<pair<int, int> > vec1, vec2;
pair<int, int> ans[maxn];
int main() {
scanf("%d%d%d", &n, &w, &... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int q_sz = 1000;
vector<pair<pair<int, int>, int> > a[500000];
vector<pair<pair<int, int>, int> > b[500000];
int x[100100], y[100100];
int main() {
ios::sync_with_stdio(false);
cout.flush();
int n, w, h;
cin >> n >> w >> h;
for (i... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
int n, w, h;
struct P {
int g, p, t, id;
P() {}
P(int g, int p, int t, int id) : g(g), p(p), t(t), id(id) {}
} pp[100010];
vector<P> vec[100010];
int tot;
inline bool cmp(const P& a, const P& b) {
if (a.g == b.g && a.g == 2)
return a.p > b.p;
else if (a.g == b... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = 300010;
vector<pair<pair<int, int>, int> > r[N], c[N];
int rz[N], cz[N];
vector<pair<pair<int, int>, int> > R, C;
int n, w, h;
int main() {
cin >> n >> w >> h;
for (int i = (1); i <= (n); i++) {
int g, p, t;
scanf("%d%d%d", &g, &p, &t);
if (g =... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
int gi() {
int a;
scanf("%d", &a);
return a;
}
long long gli() {
long long a;
scanf("%I64d", &a);
return a;
}
struct P {
int i, fx, fy, lx, ly;
};
struct A {
int x, y;
};
int n, w, h;
unordered_map<int, vector<P> > p;
unordered_map<int, vector<P> > m;
A res[... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
int n, w, h;
int g, p, t;
pair<int, int> ans[100010];
vector<pair<pair<int, int>, pair<int, int> > > v[200020], vv[200020];
void solve(const vector<pair<pair<int, int>, pair<int, int> > >& v,
const vector<pair<pair<int, int>, pair<int, int> > >& vv) {
int k = v... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import sys
def main():
n, w, h = map(int, sys.stdin.readline().split())
gv = {}
gh = {}
for i in range(n):
g, p, t = map(int, sys.stdin.readline().split())
c = p - t
t = (g, p, -t, i)
if g == 1:
if c in gv:
gv[c].append(t)
else:
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
struct people {
int p, t, i;
pair<int, int> ans;
} G1[M], G2[M];
bool cmp(people a, people b) {
if (a.p - a.t != b.p - b.t) return a.p - a.t < b.p - b.t;
return a.p < b.p;
}
bool cmp1(people a, people b) { return a.p < b.p; }
bool cmp2(people... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import static java.lang.Math.min;
import static java.util.Collections.*;
import java.util.*;
public class B {
public B () {
int N = sc.nextInt(), W = sc.nextInt(), H = sc.nextInt();
int [][] D = sc.nextInts(N);
int [] Q = new int [N];
for (int i : rep(N))
Q[i] = D[i][0];
@SuppressWarnings("unchecked"... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
map<int, vector<int> > mapV;
map<int, queue<int> > mapQ;
vector<pair<int, int> > pos[MAXN];
pair<int, int> res[MAXN];
struct Tri {
int g, p, t, id;
} seq[MAXN];
bool operator<(const Tri &a, const Tri &b) { return a.p > b.p; }
int n, w, h;
int main... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int CN = 1e5 + 10;
int read() {
int s = 0, ne = 1;
char c = getchar();
for (; c < '0' || c > '9'; c = getchar())
if (c == '-') ne = -1;
for (; c >= '0' && c <= '9'; c = getchar()) s = (s << 1) + (s << 3) + c - '0';
return s * ne;
}
int n, W, H;
map<int, ... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
vector<pair<long long, long long> > g[N][2];
pair<long long, long long> ans[N];
int main() {
ios::sync_with_stdio(false);
int n, a, b;
cin >> n >> a >> b;
int i;
for (i = 1; i <= n; i++) ... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
int n, w, h, tx[100005], ty[100005], ansx[100005], ansy[100005];
struct xx {
int x, t, id;
friend bool operator<(xx a, xx b) {
if (a.x - a.t != b.x - b.t) return a.x - a.t < b.x - b.t;
return a.x < b.x;
}
} a[100005], b[100005];
int main() {
ios::sync_with_s... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... |
/**
* @author: Mehul Raheja
*/
import java.util.*;
import java.io.*;
public class RootersSong {
/*
Runtime = O(NlogN)
*/
static int N, M, K;
static String s;
static StringTokenizer st;
static int[] d;
public static void main(String[] args) throws Exception {
BufferedRe... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
struct node {
int g, pos, id, t;
} p[maxn + 10];
vector<int> vec1[2 * maxn + 10];
vector<int> vec2[2 * maxn + 10];
pair<int, int> a[maxn + 10];
int b[maxn + 10];
bool cmp1(const int x, const int y) {
if (p[x].g != p[y].g) return p[x].g < p[y].g;
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
int g[100005];
int p[100005];
int t[100005];
int main() {
int n, w, h;
cin >> n >> w >> h;
for (int i = 0; i < n; i++) {
cin >> g[i] >> p[i] >> t[i];
}
map<int, pair<vector<int>, vector<int> > > M;
for (int i = 0; i < n; i++) {
((g[i] == 1) ? M[t[i] - p[... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
im... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
void ga(int N, int *A) {
for (int i(0); i < N; i++) scanf("%d", A + i);
}
bool R[(200006 / 2)];
int N, U, V, H[(200006 / 2)], P[(200006 / 2)], T[(200006 / 2)], a, b,
X[(200006 / 2)], Y[(200006 / 2)];
vector<int> q[200006];
deque<int> Q[200006];
bool cp(int a, int b) {... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | n,w,h = map(int,input().split())
def it(n):
for i in range(n):
g,p,t = map(int,input().split())
yield (p-t, p if g==1 else -p, i)
D = sorted(it(n))
from bisect import bisect
from itertools import chain
res = [None]*n
i = 0
while i < len(D):
k = D[i][0]
j = bisect(D, (k+1,-n,0), lo=i)
m = bisect(D,... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
const int M = 17;
const long long mod = 1e9 + 7;
const long long MOD = 998244353;
const long double eps = 0.000000001;
const int P = 1336;
const int inf = 1e9 + 7;
const int C = 1e5;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch(... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001;
struct dancer {
int g, p, t, i;
};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, w, h, i;
cin >> n >> w >> h;
dancer X[n];
map<int, vector<dancer>> Y;
for (i = 0; i < n; i++) {
cin >> X[i].g >> X[i].p >> X[i].t;
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import java.io.*;
import java.util.*;
public class ProblemB {
static int width;
static int height;
static int dancers;
public static void main(String[] args) {
// TODO Auto-generated method stub
FastScanner input = new FastScanner();
dancers = input.nextInt();
width = input.nextInt();
height = input.next... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
struct node {
int num, lab, ran;
bool operator<(const node &a) const {
if (num == a.num && ran == a.ran) return lab < a.lab;
if (num == a.num) return ran > a.ran;
return num < a.num;
}
};
set<node> sp;
map<int, int> tp;
int x[100005], y[100005], w, h, cnt,... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.*;
/**
* Created by leen on 28/09/2017.
*/
public class _848B {
public static void main(String[] args) {
Scanner scan = new Scanner(new BufferedInputStream(System.in, 1024 * 1024));
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, w, h;
bool vis[N];
struct node {
int op, p, t, res;
} a[N];
map<int, vector<int> > mp;
bool cmp1(int x, int y) {
if (a[x].op != a[y].op) return a[x].op < a[y].op;
if (a[x].op == 1)
return a[x].p > a[y].p;
else
return a[x].p < a... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
int N, W, H;
int idx[maxn], g[maxn], p[maxn], t[maxn];
int ansx[maxn], ansy[maxn];
bool cmp(int a, int b) {
if (p[a] - t[a] != p[b] - t[b]) return p[a] - t[a] < p[b] - t[b];
if (g[a] != g[b]) return g[a] > g[b];
if (g[a] == 2)
return p[a] ... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
void getint(int &v) {
char ch, fu = 0;
for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
;
if (ch == '-') fu = 1, ch = getchar();
for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0';
if (fu) v = -v;
}
const int MAXN = 1e... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
inline int rd(void) {
int f = 1;
char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
int x = 0;
for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return x * f;
}
const int N = 100005;
int n, w, h;
int g[N], p[N], t[N];
int Hash... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int Imx = 2147483647;
const long long Lbig = 2e18;
const int mod = 1e9 + 7;
struct fastio {
char s[100000];
int it, len;
fastio() { it = len = 0; }
inline char get() {
if (it < len) return s[it++];
it = 0;
len = fread(s, 1, 100000, stdin);
if (... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | //package round431;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
public class B {
InputStream is;
PrintWriter out;
String INPUT = "";
void sol... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 213;
const int MOD = (int)1e9 + 7;
const int inf = (int)5e8;
const long long infll = (long long)1e17;
int n, w, h;
int x[N];
int y[N];
struct Positions {
int x;
int y;
Positions() = default;
Positions(int x, int y) : x(x), y(y) {}
};
struct ... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167772160000")
using namespace std;
map<int, vector<int> > hor, vert;
int startPos[110000];
pair<int, int> answer[110000];
int w, h;
bool cmp(int a, int b) { return startPos[a] < startPos[b]; }
void solve(vector<int> a, vector<int> b) {
sort(a.begin(), a.end(),... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 1e4 + 10;
const long long Zero = 1e5 + 10;
vector<pair<int, int> > a[MAXN];
vector<pair<int, int> > b[MAXN];
vector<int> c[MAXN];
pair<int, int> res[MAXN / 2];
int main() {
ios_base ::sync_with_stdio(false);
cin.tie(0);
long long n, w, h;
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int n, w, h, x, y, t, ans[N];
struct node {
int op, k, t, id;
node(int _op = 0, int _k = 0, int _t = 0, int _id = 0)
: op(_op), k(_k), t(_t), id(_id) {}
friend bool operator<(node a, node b) {
if (a.t == b.t) return a.k < b.k;
retur... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e4 + 5;
const long long mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
template <class T>
inline bool read(T &ret) {
char c;
int sgn;
if (c = getchar(), c == EOF) return 0;
while (c != '-' && (c < '0' || c > '9')) c = getchar();
sgn = (c == '-') ? -1... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int N = 100010;
struct yts {
int op, bh, x, y, d;
} e[N];
bool cmp(yts a, yts b) {
if (a.d != b.d) return a.d < b.d;
if (a.op != b.op) return a.op < b.op;
if (a.op == 1)
return a.x < b.x;
else
r... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
long long n, w, h, g[((long long)101 * 1000)], x[((long long)101 * 1000)],
t[((long long)101 * 1000)];
vector<pair<long long, long long> > vec[2][3 * ((long long)101 * 1000)];
pair<long long, long long> ans[((long long)101 * 1000)];
long long out[((long long)101 * 1000)... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | import java.util.ArrayList;
import java.util.Scanner;
import java.util.Comparator;
import java.util.Arrays;
public class CF431B {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int n = sc.nextInt();
int w = sc.nextInt();
int h = sc.nextInt();
int[][] origin = new int[n][3];
... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
vector<int> v[2 * maxn];
int n, w, h;
int p[maxn], t[maxn], g[maxn], x[maxn], y[maxn];
int main() {
cin >> n >> w >> h;
for (int i = 1; i <= n; i++) {
cin >> g[i] >> p[i] >> t[i];
v[p[i] - t[i] + maxn].push_back(i);
}
vector<int> xs... |
Problem: Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage.
On the s... | #include <bits/stdc++.h>
const int N = 1e5 + 2;
using namespace std;
int n, w, h, g[N], p[N], t[N];
vector<int> grp[N + N];
pair<int, int> ans[N];
int main() {
scanf(" %d %d %d", &n, &w, &h);
for (int i = 0; i < n; i++) {
scanf(" %d %d %d", &g[i], &p[i], &t[i]);
grp[p[i] - t[i] + N].push_back(i);
}
vect... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.