Where does a competitive programmer go to work out?
Alice accidentally locked this problem behind a five digit passcode, but she forgot what it was. Apparently, if you get accepted, it means you've guessed the passcode correctly...
Help her figure out the passcode before it's too late!
Please output Alice's passcode. It is guaranteed that:
Our friend Sweat is constantly sweating about the prestige of the companies he is applying to. His friend, Perspirate, offered him a CSV table, which she claims is a comprehensive list of the most prestigious companies, alongside their ranking by prestige.
To help Sweat and Perspirate cope with their stress, you are tasked with building an application that, for each of $$$T$$$ inquiries, given a company name, check if it is on the list of prestigious companies - and if so, how highly it places on the prestige list.
The list of companies may be accessed at: https://pastebin.com/f3099efT
First, one line, representing $$$T$$$.
Then, for each of the $$$T$$$ following lines, one string representing the company name - please disregard case.
You may assume $$$T\leq 1000$$$, and no line's input will be longer than 1000 characters in length.
For each of the $$$T$$$ lines, if the company is in the list of prestigious companies, print the prestige ranking of the company (starting with 1), else print -1.
5metaCapital OnenETflIxasdfrteghafdbdhsarwgdraet wegnfr
117 40 126 87 -1
Dylan Smith noticed something fishy with the blog post. In order to confirm his suspicions, he wants you to compute the fishy frequency constant, which corresponds to the floor of the hypotenuse $$$h$$$ of the right triangle with leg lengths:
Print one integer, the fishy frequency constant.
Fortune favors the bold (?)
Output a single string $$$s$$$ without whitespace, where $$$1 \leq |s| \leq 10^5$$$.
i know!
i-don't-:(
April
Fools'
was
to
this
year,
affair.
And
Being such a good student, I was working ahead on the Find the Bug homeworks for CS104c, and I stumbled upon this secret Week 15 FTB! However, this one's got me stumped. Can you help me come up with a test case that the code fails on?
import java.io.*;
import java.util.*;
/**
*
* Problem statement:
* Given an array of 1<=n<=51 integers between -1e9 and 1e9,
* count the number of longest (strictly) increasing subsequences.
* Output this number modulo 1e9+7.
*
* Sample Input:
* 5
* 1 3 2 2 5
* Answer:
* 3
* Explanation:
* The 3 longest increasing subsequences are [1 3 5], [1 2 5], and [1 2 5].
*
*
* This problem should be a pretty straightforward dp, but I'm not sure where my bug is.
* Maybe an off-by-one error somewhere...?
* Help me find a test case that I fail on!
*
*/
public class FindTheBug15 {
static final long MOD = 100000007;
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] nums = new int[n];
for(int i = 0; i < n; i++) {
nums[i] = in.nextInt();
}
//dp[i] = number of maximum length increasing subsequences ending at nums[i]
long[] dp = new long[n];
//len[i] = maximum length of increasing subsequence ending at nums[i]
int[] len = new int[n];
//longest increasing subsequence we've seen
int mxLen = 0;
for(int i = 0; i < n; i++) {
len[i] = 1;
dp[i] = 1;
for(int j = 0; j < i; j++) {
if(nums[j] < nums[i]) {
//longer increasing subsequence(s) found
if(len[j]+1 > len[i]) {
len[i] = len[j]+1;
dp[i] = dp[j];
}
//same length increasing subsequence(s) found
else if(len[j]+1 == len[i]) {
dp[i] += dp[j];
dp[i] %= MOD;
}
}
}
mxLen = Math.max(mxLen, len[i]);
}
long ans = 0;
for(int i = 0; i < n; i++) {
if(len[i] == mxLen) {
ans += dp[i];
ans %= MOD;
}
}
System.out.println(ans);
}
}
On the first line, output a single integer $$$n\ (1\leq n \leq 51)$$$. On the next line, output $$$n$$$ space separated integers $$$a_1\dots a_n$$$ $$$(-10^9 \leq a_i \leq 10^9)$$$.
When run on your output, the code given above should produce the wrong answer.
Help me find a test case that the above code fails on!
[Output your test case here]
You are given a graph with $$$n$$$ vertices and $$$m$$$ undirected, unweighted edges. ($$$2 \leq n \leq 10$$$^$$$3$$$, $$$1 \leq m \leq \frac{n \cdot (n - 1)}{2}$$$)
Vertices are numbered from $$$1$$$ to $$$n$$$, and vertex $$$i$$$ has value $$$v_i$$$. ($$$0 \leq v_i \lt 2$$$^$$$30$$$)
Output the maximum value of $$$v_{p_1}$$$ ^ $$$v_{p_2}$$$ ^ ... ^ $$$v_{p_k}$$$ where $$$p$$$ is a an array with distinct values ($$$1 \leq p_i \leq n$$$, $$$1 \leq k \leq n$$$), such that there is an edge between $$$p_i$$$ and $$$p_{i+1}$$$ for $$$1 \leq i \lt k$$$, and ^ denotes the bitwise XOR operator.
The first line of input will consist of two integers $$$n$$$ and $$$m$$$. ($$$2 \leq n \leq 10$$$^$$$3$$$, $$$1 \leq m \leq \frac{n \cdot (n - 1)}{2}$$$)
The next line will contain $$$v_1 ... v_n$$$. ($$$0 \leq v_i \lt 2$$$^$$$30$$$)
The $$$i$$$th of the next $$$m$$$ lines will contain $$$a_i$$$ and $$$b_i$$$, denoting an edge between vertex $$$a_i$$$ and vertex $$$b_i$$$. ($$$1 \leq a_i, b_i, \leq n$$$, $$$a_i \neq b_i$$$, each edge is unique)
Output the answer.
5 51 4 3 2 51 22 33 44 53 5
7
You're playing your favorite (and the best) mobile rhythm gacha game, D4DJ Groovy Mix.
Rates:
3% for 4* card
70% for a 4* card to be a collaboration member.
25% for a collaboration member to be Hitagi Senjougahara (the other collab members are Nadeko, Mayoi, and Suruga)
Output any 32-bit signed integer (which is used to seed the RNG) on the first line in order to do 10 pulls on the banner.
Draw 10 for 3000 diamonds
12
Thanks for sticking around! Now that you've had some time to try out the problems, we want to know—which one was your favorite?
Cast your vote here!
Your favorite problem