USO
Ultra Spiritual
Being ultra spiritual has nothing to do with actually being spiritual.
Being ultra spiritual means you look spiritual
First Blood
'
C
or
Python?
Python
print('\n'.join(list(map(lambda k : ["Yes, I can.","USO!","No, I can't."][int(int(k[0])
*2//3+1<=int(k[1]))+int(int(k[0])*2//3+1==int(k[1]))],[input().split() for _ in range(int
(input()))]))))
C
#include<stdio.h>
int main(){
int T,N,S;
scanf("%d",&T);
while(T--){
scanf("%d%d",&N,&S);
if(N*2/3+1 == S) printf("No, I can't.\n");
else if(N*2/3 >= S) printf("Yes, I can.\n");
else printf("USO!\n");
}
}
Spiorad Algorithm
with your ultra spiritual
Step I -- lower bound
I accidentally make it happen.
N=3n
9:00~12:00 | 13:00~16:00 | col1 + col2 | 17:00~20:00 |
---|---|---|---|
N=3n
9:00~12:00 | 13:00~16:00 | col1 + col2 | 17:00~20:00 |
---|---|---|---|
0 | |||
1 | |||
n-1 | |||
n | |||
n+1 | |||
n+2 | |||
2n-1 | |||
2n |
N=3n
9:00~12:00 | 13:00~16:00 | col1 + col2 | 17:00~20:00 |
---|---|---|---|
0 | n | ||
1 | n+1 | ||
n-1 | 2n-1 | ||
n | 2n | ||
n+1 | 0 | ||
n+2 | 1 | ||
2n-1 | n-2 | ||
2n | n-1 |
N=3n
9:00~12:00 | 13:00~16:00 | col1 + col2 | 17:00~20:00 |
---|---|---|---|
0 | n | n | |
1 | n+1 | n+2 | |
n-1 | 2n-1 | 3n-2 | |
n | 2n | 3n | |
n+1 | 0 | n+1 | |
n+2 | 1 | n+3 | |
2n-1 | n-2 | 3n-3 | |
2n | n-1 | 3n-1 |
Ans:{2 \over 3}N + 1
N=3n+1
9:00~12:00 | 13:00~16:00 | col1 + col2 | 17:00~20:00 |
---|---|---|---|
0 | n | n | |
1 | n+1 | n+2 | |
n-1 | 2n-1 | 3n-2 | |
n | 2n | 3n | |
n+1 | 0 | n+1 | |
n+2 | 1 | n+3 | |
2n-1 | n-2 | 3n-3 | |
2n | n-1 | 3n-1 |
Ans: \lfloor{2 \over 3} N \rfloor+ 1
N=3n+2
9:00~12:00 | 13:00~16:00 | col1 + col2 | 17:00~20:00 |
---|---|---|---|
0 | n | n | |
1 | n+1 | n+2 | |
n | 2n | 3n | |
n+1 | 2n+1 | 3n+2 | |
n+2 | 1 | n+3 | |
n+3 | 2 | n+5 | |
2n | n-1 | 3n-1 | |
2n+1 | n | 3n+1 |
Ans: \lfloor{2 \over 3} N \rfloor+ 1
Step II -- upper bound
Not exactly important
Assume we can tolerate at most k gamers.
9:00~12:00 | 13:00~16:00 | 17:00~20:00 |
---|---|---|
a1 | b1 | c1 |
a2 | b2 | c2 |
ak | bk | ck |
Assume we can tolerate at most k gamers.
9:00~12:00 | 13:00~16:00 | 17:00~20:00 |
---|---|---|
a1 | b1 | c1 |
a2 | b2 | c2 |
ak | bk | ck |
- For one column, each number can't appear twice.
- Hint for RHS :
\sum\limits_{i=1}^{k}a_i \ge {k(k-1)\over2}
Assume\ a_i\in \{x\ |\ 0\leq x\lt k\}
Assume we can tolerate at most k gamers.
9:00~12:00 | 13:00~16:00 | 17:00~20:00 |
---|---|---|
a1 | b1 | c1 |
a2 | b2 | c2 |
ak | bk | ck |
\sum\limits_{i=1}^{k}a_i+\sum\limits_{i=1}^{k}b_i+\sum\limits_{i=1}^{k}c_i \ge 3\times {k(k-1)\over2}
Assume we can tolerate at most k gamers.
\sum\limits_{i=1}^{k}a_i+\sum\limits_{i=1}^{k}b_i+\sum\limits_{i=1}^{k}c_i \ge 3\times {k(k-1)\over2}
kN \ge 3\times {k(k-1)\over2}
k \le \lfloor {2\over 3}N\rfloor+1
USO
By piepie01
USO
- 351