Hi, all!
This is not Tommyr7, but the impostor behind the round :P. The statements are written by me. The characters in the round feature, again, the Monogatari anime series, and to be more specific, Nisemonogatari: Fake Tale. The statements involve stories with fake things and oddities, but as per tradition, contain no spoilers. Thank you, everyone, and hope you've all enjoyed the round!
On a side note, special kudos to the best impostors of the round (except me, lol)!
Any feedback on problems and tutorials are welcome -- we look forward to doing even better in the future!
Here are hints for all problems and detailed tutorials for the first two. Stay tuned, more are coming!
Hints
Problem AFirst approach: Optimize the straightforward solution.
... or even...Second approach: Believe in magic.
Problem BMultiply instead of divide. What happens to the last digit when multiplying?
Problem CConsider islands of two colours and the bridges between them.
Problem DIterate over all possible combination, order and direction of extra edges.
Problem EFirst approach: 2D segment tree (or quadtree) with a set or vector on each node, representing the set of barriers that cover this node.
... or may as well...Second approach: Assign a random value to each barrier. Then utilise 2D Fenwick trees.
Tutorials
Author Tommyr7, cyand1317 / Preparation Tommyr7, cyand1317 / Tutorial cyand1317
Solution 1 (Tommyr7)#include <bits/stdc++.h>
using namespace std;
#define Maxn 4000007
bool vis[Maxn];
int a[4007],b[4007],n;
int main()
{
scanf("%d",&n);
memset(vis,false,sizeof(vis));
for (int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
vis[a[i]]=true;
}
for (int i=1;i<=n;i++)
{
scanf("%d",&b[i]);
vis[b[i]]=true;
}
int ans=0;
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
if (vis[a[i]^b[j]]) ++ans;
if (ans%2==0) printf("Karen\n"); else printf("Koyomi\n");
return 0;
}
Solution 2 (cyand1317)#include <stdio.h>
int main()
{
puts("Karen");
return 0;
}
Author Tommyr7 / Preparation Tommyr7 / Tutorial cyand1317
Model solution (Tommyr7)#include <bits/stdc++.h>
using namespace std;
long long L,R;
int ans;
int main()
{
scanf("%lld%lld",&L,&R);
if (R-L>=10) printf("%d\n",0);
else
{
ans=1;
for (long long i=L+1;i<=R;i++)
ans=(1LL*ans*(i%10))%10;
printf("%d\n",ans);
}
return 0;
}