// _
// ^ ^ //
// >(O_O)<___//
// \ __ __ \
// \\ \\ \\\\
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("popcnt")
/*
⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⣳⣳⡳⡳⡳⡳⣳⡳⡳⠳⠷⣳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳
⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⠼⣚⣨⣤⠶⢖⣖⣶⣶⣤⣤⣶⣿⣿⣄⣨⣷⣶⣬⣑⠪⡼⡪⢮⡮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮
⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⢝⡥⣺⣿⣾⣿⣿⣯⣋⣾⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⣿⣿⣷⣤⠚⣳⣺⢝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝
⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⣣⢚⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠙⢮⡮⡗⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳
⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⠮⡴⠋⣴⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣭⣭⣴⣶⣶⣶⣶⣶⣮⣀⡀⠁⠠⠙⢮⣪⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮
⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⡵⠉⡀⡀⡿⢋⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣛⡛⢛⠛⠻⢄⠂⡀⡀⠙⣞⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝
⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⠞⡀⡀⢀⠔⢀⢣⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣼⣷⣞⣝⣣⣜⡤⢤⠠⢌⢷⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⣳⢗⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳
⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢎⠏⡀⡀⣴⠊⡾⣿⡨⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⣿⣿⣿⣯⣾⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡢⡀⠻⡼⠮⣎⣮⠼⠮⣊⣊⣊⣚⠫⢝⣝⡮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮
⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⡝⡟⡀⡀⣰⡎⣜⣿⣿⣿⣿⣿⣿⣿⠛⢡⠟⣿⡞⣾⣿⣿⣿⣿⣿⣿⣿⣽⣮⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⡗⢑⠤⠙⣥⡶⣟⡫⢕⣖⣲⣖⡦⡝⣍⢷⡳⡺⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝
⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡾⡀⡞⣣⣮⣾⣿⣿⣿⣿⣿⡿⣯⡿⣏⣾⣿⢸⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡻⣌⡻⣿⣿⣷⣌⡿⣿⣿⣿⣿⣿⣿⣿⣌⠣⡨⠫⣪⢗⡺⢵⡳⡳⣫⢮⢮⣆⢧⢮⢮⢵⡳⡳⢳⡳⡳⡳⡳⡳⡳⡳⡳⡳
⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⣱⢀⣿⣼⢿⣿⣿⣻⡿⣴⢱⣼⢷⣿⢱⣿⣿⣿⣷⣾⣹⣿⣿⣿⣿⣿⣿⣿⣯⣿⣿⣝⢷⣕⢝⢿⣿⣛⠟⢯⣿⣿⣿⣿⣿⣭⠿⣌⠿⣌⢮⢮⢷⠮⣎⣪⠽⢝⣝⣝⣝⣝⣝⣕⡾⣾⢮⢮⢮⢮⢮⢮⢮⢮⢮
⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⡍⠇⣿⡇⣱⣿⣿⣳⣫⣿⡵⣼⢏⣿⡿⣿⣿⣿⣿⣯⣿⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣻⣿⣿⡙⢿⣾⣦⢝⠿⣦⣐⠉⠛⠿⠿⣿⣿⢶⡛⣶⣷⣙⢋⣥⡶⢖⡭⢝⣳⡮⣗⡳⣳⠞⣴⡫⢝⣝⣝⣝⣝⣝⣝⣝⣝
⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⣳⢸⣾⣿⣿⣿⣿⣯⡿⡿⣿⣾⣧⣿⣿⣿⣿⣿⣿⣿⣏⣿⡼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣝⢿⣦⡛⣿⣿⣷⣯⣶⣭⣉⣓⣀⣀⣀⣀⣤⠾⡫⢬⣛⠦⣙⠺⠮⢮⣞⣕⣧⠞⣁⡾⢝⡳⢮⢵⡳⡳⡳⡳⡳⡳⡳
⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⡮⢮⠮⣙⠵⠛⠛⠛⠛⡩⡰⣠⣿⣻⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⢸⣿⡇⣿⣿⡞⣿⣿⣿⣿⣿⣿⣻⣿⣿⣿⣿⣿⣦⣭⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡑⡯⡗⡺⡳⢦⡭⢍⣛⣖⣺⢯⢵⡳⡳⡫⢝⣝⣕⣪⢮⢮⢮⢮⢮
⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⣝⡝⣕⣪⠗⠋⡀⡀⡀⣠⣖⡰⢺⢼⣿⠻⠟⢋⣮⡾⣫⣿⣿⣿⣿⣿⣿⢸⣿⣷⢹⣿⣷⢿⣿⣿⣿⣿⣿⣿⣷⣍⠻⣿⣿⠿⣿⣿⣿⣿⢿⣆⣿⣿⣿⣿⣿⣿⣿⣿⣌⣗⣪⢮⣝⣝⣝⡮⣞⡮⣝⣝⣕⣪⢮⢮⢗⡳⡳⡫⢝⣝⣝⣝
⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⡳⠓⢵⢿⡇⡄⡀⡀⡀⡀⢰⣃⡶⡸⢕⠢⡙⢿⣞⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸⢮⡌⣷⢿⣿⡌⣿⣿⣿⣿⣿⣿⣿⡿⣿⣶⣬⡙⠦⣙⠻⣿⣿⣌⠜⣿⣿⣿⣷⠙⣿⣷⣝⣦⢳⣫⢵⡳⡳⡫⢝⣝⡳⡳⡳⡳⡫⢝⣝⣝⡮⢮⢮⢗⡳⡳
⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢮⢎⡵⠛⠸⣿⣹⣿⢽⡀⡀⡀⠦⢿⣕⡪⠕⠠⢂⡇⣟⣫⣶⠿⣻⣽⣿⡇⣿⢿⣿⣿⢸⡝⡇⡟⡻⣿⣿⡘⣿⣿⡏⡜⠻⡆⠻⣎⢿⣿⣿⣿⣶⣭⣅⣈⡛⠷⣌⣿⣿⣿⣷⠑⡙⢿⣷⣧⡺⣝⣕⣪⢮⢮⢗⡮⢮⢮⢮⢮⢮⢗⡳⡳⡺⣝⣝⣝⡮
⣝⣝⣝⣝⣝⣝⣝⣝⣝⡽⡋⡟⡀⡀⡀⡀⣿⣯⣿⠇⡀⡀⡀⡀⡀⡀⠛⡄⡂⢐⡁⡀⡀⢈⣾⡾⣻⣿⡇⣿⢸⣿⣿⡞⡇⣿⠘⡹⡹⣿⣷⢪⣿⣿⡟⣳⠉⢮⢦⠳⣌⠿⣿⣿⣿⣍⠻⣿⣿⣶⣤⠻⣿⣿⣿⠱⢲⡙⣿⣎⣷⣗⡳⡫⢝⡵⡳⡺⣝⣝⣝⣝⣝⣝⡮⢮⢮⢵⡳⡳
⡳⡳⡳⡳⡳⡳⠳⣡⠚⢵⠨⣿⡀⡀⡀⠔⢹⣿⣽⡪⡀⡀⡀⡀⡀⡀⡀⠹⡈⢊⡁⣿⠟⣙⣡⣾⣿⣿⡇⣿⠸⣟⣿⢸⣷⣺⡀⢻⢹⡙⣿⣷⠻⣿⡞⡈⢳⡀⠉⠮⣈⢷⡑⡙⣿⣿⣿⣜⣿⣿⣿⣿⣦⠻⢿⣿⣔⡯⢦⠻⡄⢷⣎⣪⢮⣝⡮⢮⢮⢵⡳⡳⡳⡳⡳⡺⣝⣝⣕⣪
⣎⣪⢮⢮⣎⠴⠉⡀⡀⠈⡌⣿⣧⡀⡂⢂⠈⣿⡷⣗⠬⣵⡀⡀⡀⡀⡀⡀⠹⠈⠡⠌⣉⡉⠒⠛⣹⣿⠅⣿⡀⢷⢿⣟⠸⡄⡇⡀⢷⢿⣌⢿⣗⣝⣮⢻⠱⡙⢤⣀⡀⠙⠿⠶⣁⢻⣿⣿⣿⣿⣿⣷⡙⢿⣑⣻⣦⠳⡪⡺⣻⡀⢿⢽⢮⡺⢵⡫⢝⣝⣕⣪⢮⢮⢮⢮⢮⢵⡳⡳
⡳⡳⣫⠛⡀⡀⡀⡀⡀⡀⢻⢿⢿⣷⠈⢀⡅⣿⣿⠡⡱⡏⠂⣷⣀⡀⡀⡀⡀⡹⣿⣿⣶⠶⠚⢁⣿⢸⡆⣿⡇⣗⠸⠈⡄⣿⢹⡀⡀⣳⢻⣷⡙⣆⢦⡓⣷⠈⠓⠬⣙⡻⠭⠛⣛⡉⢷⣿⣿⣿⣿⡘⣿⣷⣬⣒⠽⣶⠤⠛⠾⡀⡼⢯⣝⣕⣪⢗⡺⢵⡳⡳⡫⢝⣝⣝⣝⣝⣕⣪
⡥⠋⡀⡀⡀⡀⡀⡀⡀⡀⡃⢻⣯⣿⣿⡘⡵⢹⣿⠸⢎⢸⢰⣿⣿⣷⣄⡀⡀⡀⡀⠙⣙⠛⣿⣿⣿⡇⡇⣿⣿⢯⡇⡇⣇⠘⣿⡄⠤⠄⠽⡙⣿⣦⢆⠙⣦⣽⣦⣀⡀⣠⣾⣛⣯⠉⠛⣿⣿⣿⣿⠻⡀⡀⠻⣿⣿⣷⠹⢿⡟⡫⢕⢪⡱⡳⡳⣫⢗⡺⣕⣪⢮⢮⢗⡳⡳⡳⡳⡳
⡀⡀⡀⡀⡀⡀⡀⡀⡀⠞⠅⡀⠹⣾⣿⣿⢼⢼⣿⡂⢽⡿⣾⣿⣿⣿⣿⣷⣤⣤⣤⣤⣶⣶⡶⣿⣿⡇⡇⣿⣿⡎⡺⢇⣝⣴⣎⣿⡹⡟⠿⣮⢦⠻⣿⣦⢠⠻⣙⠛⠯⣤⡴⣻⣟⠉⠁⠏⢻⣿⣿⣿⡹⡀⡀⢀⡉⠿⣿⣌⢯⢮⣝⣕⣜⡮⢮⢞⣝⣝⡮⢵⡫⢝⣝⣝⡮⢮⢮⢮
⡀⡀⡀⡀⡀⡀⡀⡀⢘⡑⠎⠢⠔⡴⢹⣿⡌⣿⣿⡇⢆⢃⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣴⠶⣦⠹⣿⣿⣿⣗⡼⢺⢸⢛⣭⣬⢿⣮⡈⡀⠙⢍⢮⢿⣕⡈⠲⣑⡄⡈⠛⢀⠏⣀⠞⣼⣧⢿⣧⢿⣿⣌⡀⢦⢿⡄⢼⢾⡷⡙⢵⡳⡳⡳⡺⢵⡳⡳⡳⡺⣕⣪⢗⡳⡳⡺⣝⣝
⡀⡀⡀⡀⡀⡀⡀⡀⠇⢅⢢⢂⢋⢯⢇⣿⣿⢸⣿⡧⣼⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣡⡁⣅⠲⣌⡀⣿⣻⣿⣿⢧⣏⡆⣞⠐⠡⣙⣫⢀⠳⣄⡀⠙⢌⠻⣟⠷⣤⣀⣉⠁⡀⡀⡀⡀⡃⡙⣷⣟⡆⣿⣿⣝⣟⣦⣿⣦⢺⣟⣷⡲⡳⡮⢮⢮⣝⣕⣪⢮⢮⢮⢵⡫⢝⡮⢮⢮⢵
⡀⡀⡀⡀⡀⡀⡀⢌⠌⠑⡴⢵⣺⣝⣝⢹⣿⣿⣿⣃⠃⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣕⣿⣧⠦⡠⢸⡀⣿⣸⣿⢻⡜⣿⢿⡀⢧⡀⡀⢦⠳⡈⡀⡀⡀⡀⠈⠂⠈⠉⠐⡀⡀⡀⡀⡀⢰⣿⣦⡀⠻⣟⣿⣿⣿⣦⢻⣿⣿⡔⣽⢷⡛⣦⡳⣹⢮⢮⢵⡳⡫⢝⣝⣝⣕⣪⢗⡺⣝⣝
⡀⡀⡀⡀⡀⢀⠢⢊⠌⣞⡮⢮⢗⡳⡳⡂⣿⣿⣿⣿⢸⣿⡼⣿⣿⣿⣿⣿⣿⡿⣰⣿⣿⣿⣿⣄⠪⣹⢸⡯⢿⡈⣷⢻⡎⡄⡀⡄⡀⡀⠑⡀⠑⡀⡀⡀⡀⡀⡀⡀⠃⡀⡀⡀⡀⡀⣾⣿⣿⣟⢷⣬⡻⣦⠻⣿⡙⣿⣿⣿⡈⢯⡹⣷⣭⡲⣙⢬⡫⣗⡮⢮⢗⢳⡳⡳⡫⢝⡮⢵
⡀⡀⡀⡀⠠⠣⢂⢉⢟⡳⡳⡺⣝⣝⡮⢮⢿⣿⣿⣿⣿⡰⢜⣿⣿⣿⣿⣿⡿⣰⣿⣿⣿⣿⣿⣿⣻⣤⡀⣷⡆⣇⢻⡌⣿⢷⡀⠈⡄⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⣿⣿⣿⣿⣿⣷⣭⡻⢿⣌⢿⣶⡙⣿⣿⡘⡝⣦⢿⣮⣳⣽⣦⡙⠦⣜⡫⠣⣹⡮⢮⢮⢗⡮
⡀⡀⡀⢄⡁⠌⢁⢫⢗⡮⢮⢮⢮⢵⡳⡺⢸⣿⣿⣿⡄⡎⢱⣿⣿⣿⣿⡟⣼⣿⣿⣿⡟⣿⣿⣿⣧⣿⣿⣿⢻⡹⡀⣿⢻⣇⡄⡀⠈⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⡀⢠⢿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣭⡈⢻⣷⣬⡻⡌⠦⡻⣌⢿⣿⣾⣟⠷⣤⡀⠉⠛⠒⠶⠬⢭⣬
⡀⢀⡌⢌⡱⢡⡣⡹⡳⡳⡺⣝⣝⣝⣕⡪⠄⣿⣿⣿⣇⠌⡿⣿⡿⣿⠟⢼⣿⣿⣿⣿⢰⣿⣿⣿⣿⡹⣿⣿⡎⡀⣧⡘⣇⣿⡸⡀⡀⠈⡄⡀⡀⡀⡀⡀⡀⡀⢀⡄⡀⡀⡀⡀⣠⣿⣿⣶⣙⠻⠿⣿⣿⣛⡻⡿⢿⣿⣿⣦⣙⢟⣶⣾⢟⣋⠻⣌⠿⣿⣿⣿⣶⣽⣳⣶⣤⣄⣀⣀
⢌⡨⢌⣅⣡⡑⣜⣎⣪⢮⢮⢮⢵⡳⡳⢎⠋⣿⣿⣿⣿⢠⠇⢣⣸⠏⢪⣿⣿⣿⣿⡟⣾⣿⣿⣿⣿⣷⣻⣿⣿⢷⡆⣎⠹⣿⣿⢳⡀⡀⠈⢄⡀⡀⡀⡀⡀⠈⡀⡀⡀⡀⣀⣾⣿⣿⣿⣿⣿⡉⡻⣯⣓⠶⢿⣿⣿⣶⣦⣭⣏⠻⣦⡋⣿⣿⣿⣷⠷⣈⠻⣿⣿⣿⣿⣿⣿⣿⡙⠓
⣦⣍⡃⣰⣃⣾⢦⣍⣝⣺⣝⣝⡝⣕⣪⠋⢬⢸⣿⣯⣷⢺⣸⡯⡏⠇⣿⣿⣿⣿⣿⡃⢸⣿⣿⣿⢿⣿⣯⣻⢿⣿⡇⡘⡔⢻⣿⣿⢣⣀⡀⡀⢦⡀⡀⡀⡀⡀⡀⡀⣠⢞⠛⢦⣈⠩⣛⠷⣟⢿⣆⢯⣶⡭⣽⣷⣶⣬⣿⣿⣿⣿⣶⣙⣦⣿⣿⣿⣿⣾⣻⣦⡝⠿⣿⣿⣿⣿⣿⣷
⠪⢱⢖⣲⡺⢛⣼⣿⣿⣿⣿⣿⣿⣿⣶⡈⡿⡀⣿⣿⣽⡀⣿⢇⡯⣼⣿⢯⣿⣿⣿⡀⡆⣿⣿⣎⣧⢿⣿⣧⣿⠞⣿⠙⠘⡔⢻⣿⣿⣧⠻⢶⢤⣃⡀⡀⡀⡀⢀⢞⣺⢗⡳⡳⢬⠻⣷⣍⠲⢝⡮⣳⡙⣷⢾⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡻⠿⣿⣿⣿⣿⣶⣝⠿⣿⣿⣿
⣴⣿⣷⣮⠓⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡷⣯⣿⣿⣿⢷⢻⢸⢡⣿⡿⡇⣿⣿⠇⡀⣿⡜⣿⣿⡄⢷⠻⣽⢿⠘⠸⣳⠱⡌⣆⢻⣿⣿⣷⢸⠨⠵⠻⡙⡖⢾⣱⢎⣕⡸⢮⢼⣫⢧⢖⣍⢿⣦⠲⢝⠿⣦⡙⢯⣝⠟⠿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣎⢮⣛⢿⣿⣿⣿⣷⣬⣛
⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣮⣻⣿⣿⡯⣦⢼⡟⣿⡇⠅⣿⣿⠐⢷⢿⣜⡈⣿⣝⡄⠙⣭⡸⡀⡀⡀⠙⣜⠮⣷⣿⣿⣿⣷⡁⡀⠁⠓⡁⣃⡀⡟⢧⡹⡬⡎⢸⢱⢼⣗⢯⣬⠻⣌⢮⡲⣍⠷⣍⠿⣷⣤⣀⠋⠹⢗⣣⣝⣛⣛⡛⠻⢿⣿⣽⢯⣲⣝⡻⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣿⣿⣿⣽⣌⠓⠷⠬⣧⣿⠿⢧⣎⣓⢌⠪⢂⣹⠿⡛⣦⣧⡇⠙⢄⡀⡀⠻⣦⡙⣿⣿⣿⣿⣄⢸⡀⡝⡀⢰⢺⣎⠙⠶⣕⠮⣝⠚⠟⢟⣛⠿⠦⡳⡈⠻⣽⣷⣭⡳⣷⣿⣿⡿⣶⣵⣎⣙⠻⠿⢿⣿⣷⣮⣝⠾⣟⣮⡻⣬⡻
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣻⣅⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢾⡾⣿⠟⡀⡀⠈⢀⡀⢄⠻⣓⣿⣿⣿⣿⣮⢀⢿⣹⢳⢫⢋⢱⣼⣦⡚⢻⠉⠁⡀⡀⡀⡎⠈⢮⣮⢦⡛⣿⣿⣿⣶⣬⣙⠛⠦⣔⡢⢬⡭⢍⣍⣛⣛⡛⠷⠾⢿⣭⣷⣝
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⢸⣻⣿⣿⣿⡿⣦⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣇⠢⡆⡀⡀⡀⠛⠈⢨⡄⡙⢿⣻⣿⢿⣿⣄⢇⢿⡎⣇⡟⣮⡇⣟⣩⣿⣿⣿⣿⣷⡃⠄⠆⢳⣳⣙⠦⠉⠻⣿⣟⠻⣿⣿⣿⣶⣿⣶⣬⣉⣓⣚⣓⣈⣩⣭⣤⣤⣬
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⢿⣿⣿⣿⡿⣿⣝⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⡀⢀⢄⡀⡄⢸⠘⡐⣱⠨⠛⣼⡜⡟⣿⣸⣷⣟⣠⣸⡟⣾⣘⣝⣭⢙⢏⡟⣾⣵⣠⠁⠹⣿⡳⡀⢈⢄⡉⠻⣦⠠⣉⢛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡹⣿⡹⣿⣿⣿⣿⣿⣞⣿⣶⡻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⡀⠈⣌⠘⠽⡜⡀⣯⠹⣙⢿⡟⢿⣹⣯⣿⣱⣧⡟⡿⣴⢟⣵⠟⣿⡿⣭⣿⣆⢠⠻⣿⣮⢷⡀⠛⣾⣔⠩⢛⣜⣝⠿⣮⣽⣻⡿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢻⡞⣿⣿⣿⣿⣮⡻⣿⣬⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣤⣙⠜⡈⡀⡵⢲⣉⣽⠗⢦⣿⣿⣻⣛⣭⡮⣥⢷⣯⣻⣿⣿⡿⣻⣷⣷⣕⢿⣿⣿⣮⢷⣀⠛⣿⣾⣕⠯⣝⡛⠶⣭⣙⣛⣛⣛⣛⣏⣭⣭
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢻⢻⣿⣿⣿⣿⣿⡳⣝⠿⣷⣍⠻⣿⣿⣿⣿⣿⣯⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡞⣬⣘⡗⢿⢿⣮⢹⠟⢿⡙⣷⡿⣼⢗⣯⣭⣶⣶⣿⣿⣿⣿⣿⣿⣮⠻⣿⣿⣿⣿⣤⠛⢿⣿⣿⣶⣬⣭⣊⣙⠛⠻⣿⣿⣿⣿
⠻⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢧⣿⣿⣿⣿⣿⣿⣿⣿⣷⣝⣿⣦⠙⢿⣿⣿⣿⣿⣎⢹⢿⣿⣿⣿⣿⣿⣿⣽⡿⣿⣿⣶⣿⠫⣿⣿⢿⣾⢧⣧⣿⣿⢟⣋⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣝⡿⣿⣿⣿⣿⣿⣿⣿⣿⢟⣷
⢮⣝⡲⢭⠙⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣞⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣝⢿⣦⡉⠿⣿⣿⣿⣷⣦⣜⠟⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣻⣿⢿⢿⣿⣿⣽⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡷⢿⢟⣝
⡝⣣⣞⣡⢫⣿⣿⣿⣿⣿⣷⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢜⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⢻⣷⣌⠻⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⢱⣿⠙⠹⣷⡇⣨⠁⠉⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣠⣾⣿⣿⡿⡿⡿⢊⣼⣵⣿
⢮⠮⠞⣾⣿⣿⣿⣿⠟⢡⠃⣿⣍⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣞⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢷⡌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⣠⣿⢻⡀⣇⢹⠋⡀⡠⠲⣄⡀⡀⠉⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣯⣶⣶⣺⣿⣭⣶⣾⣿⣿⡿⣫
⣝⠟⣾⣿⣿⣿⠟⣡⢇⠇⣾⣿⣿⣷⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡝⣄⠙⣿⣿⣿⣿⣿⣿⣿⣿⢋⣾⣿⢁⢸⡇⣿⢱⡞⢥⡀⡀⡀⠉⢦⠄⡀⣿⣿⣿⣿⣿⣿⣟⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣟⣯⣾⠟⣡
⡟⡀⣿⣿⡿⡡⢵⡫⡿⢱⣿⣿⣿⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣞⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣷⡈⢿⣿⣿⣿⣿⣿⣿⣿⡟⡀⡀⢸⡇⣿⢸⡧⡁⡞⠉⠉⠢⣼⣢⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣻⣿⣿⣮⡨⡍⢩⣉⣉⣉⠩⠍⣀⠴⣩⢊
⡀⣸⣿⠟⢴⢗⣞⣱⡘⣿⣿⣿⣿⣿⣿⣿⣿⡇⣭⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣦⠹⣿⣿⣿⠠⠈⡀⡀⡑⠁⣿⡇⢸⢸⡇⠎⠌⡵⠤⡀⡀⡀⡀⡀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣦⡈⠃⠊⠛⠉⠁⡀⠞⡵⡥
⡀⣿⠏⡺⣝⡵⢃⠏⣾⣿⣿⣿⣿⣿⣿⣿⣿⡇⡏⣗⡯⣖⡤⠻⣿⣿⣿⣿⣿⣿⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣌⢿⣿⡀⡀⡇⡀⡀⣼⣿⡀⢸⡸⡇⠌⠞⡀⣀⡀⠉⠒⣀⡀⡀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢙⠿⣿⣻⡿⡿⣽⣆⣀⠄⣀⡴⣫⡧⡞
⡀⡟⡫⣗⣳⡎⠟⣾⣿⣿⣿⣿⡿⣿⣿⣿⢹⡇⡇⣫⢧⣕⡪⢕⡙⣿⣿⣿⣿⣿⣿⣿⣮⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣷⣻⡀⡀⡇⡀⡀⠙⡏⠐⣸⡇⠇⠋⢠⠁⡀⠈⠒⡀⣀⠈⡀⠈⣿⣿⣿⣿⣿⣿⣿⣿⡯⢗⡿⢯⢧⡮⢵⢦⡭⡩⣛⣛⣻⡭⡲⡫⢝⣕⣪
⢰⣧⡽⢮⡕⣞⣿⣿⣿⣿⣿⡟⣸⣿⡿⡡⣿⡇⡇⣪⢮⢞⡵⣫⢗⡦⠻⣿⣿⣿⣿⣿⣿⣿⣙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣷⡀⡇⡀⢠⡰⢁⢠⣿⢸⡀⡇⠈⡀⡟⢄⢄⡀⡀⡀⡀⡀⠈⣿⣿⣿⣿⣿⣿⣿⠱⣡⣾⡇⡜⡜⢝⣝⣏⣪⢮⢮⢮⢮⢮⢮⢮⢗⡳
⠨⣿⢹⡝⣼⣿⣿⣿⣿⣿⠟⢁⣿⠟⢴⡇⣿⡇⡇⢵⢯⢗⢪⢞⣝⡵⡫⢌⢿⣿⣿⣿⣿⣿⣿⢷⡻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢿⣌⡀⡀⠚⢡⣿⣿⣾⣠⢹⢠⣆⠘⡀⠹⠢⡀⡀⡀⡀⡀⠹⣿⣿⣿⣿⣿⣿⣎⣳⣿⡱⢂⢣⢮⢵⡳⡳⡫⢝⣝⣝⣝⣝⣝⣝⣝
⡸⣿⣆⣜⣿⣿⣿⣿⣿⠏⠎⡿⣡⣗⣜⢀⣿⡇⢇⢺⣝⣝⣝⡵⡳⣫⢮⢮⢇⣟⣿⣿⣿⣿⣿⣿⣿⣜⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠙⣿⣽⣷⡀⡀⢈⣿⢡⡿⠐⡀⠁⢘⠴⡨⠇⢧⠈⠢⠢⠤⡀⡀⠿⣿⣿⣿⣿⣿⣷⣿⣿⣹⣿⣧⢞⣝⣕⣪⢮⢮⢗⡳⡳⡳⡳⡳⡳
⢧⣿⣿⣿⣿⣿⣿⣿⢋⣡⢫⡺⡳⡳⣳⣸⣿⢣⢸⡳⡳⡳⡳⣫⢮⢮⣝⣝⣝⡸⡎⣿⣿⣿⣿⣿⣿⣾⣦⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⡀⠙⣯⢿⣦⠃⡀⣾⠇⡀⡀⡀⡂⡇⣱⠆⡀⠳⡁⡄⡀⣴⣭⣌⣠⢻⣿⣿⣿⣿⣿⣸⣸⣿⣿⣆⢗⡳⡳⡫⢝⣝⣝⡮⢮⢮⢮⢮
⠘⣿⣿⣿⣿⣿⣿⣫⢛⣜⣝⣕⣪⢮⠇⣿⣿⢸⣗⡮⢮⢮⢮⢞⣝⣝⡳⡳⡳⣣⢿⡧⣿⣿⣿⣿⣿⣿⣿⣷⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⡀⡀⠐⠉⠿⣿⣦⣿⡀⢀⡀⡀⠈⣷⣎⠄⠅⡆⠈⠲⣼⣿⣷⣟⠿⠃⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⢗⣪⢮⢮⢗⡳⡳⡺⣝⣝⣝
⢾⣿⣿⣿⣿⣿⣿⣌⠚⣳⢳⣳⢗⣳⢰⣿⣿⡟⢯⣗⡯⣝⣝⡵⡳⡳⢼⣪⢮⢮⡈⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿⣎⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⡀⡀⠆⡀⡀⢸⡞⢿⣌⡀⡀⡘⢸⢹⢀⢈⢀⠳⢀⣿⣿⠟⡀⠐⡀⡀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⢮⢝⣝⣝⣝⡮⢮⢮⢵⡳
⠘⣿⣿⣿⣿⡟⠿⣿⣿⣷⣦⣍⡓⠃⣿⣿⡇⠇⠲⠳⠓⢓⣓⣋⣊⣚⡋⠽⡺⣝⡹⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⢿⣿⣿⣿⣿⣿⣿⣿⣿⣆⡀⡀⡀⡀⡀⣿⠁⡀⢈⠻⣶⣌⠘⠼⠨⠥⠸⣈⣾⣿⣿⡀⠐⠠⡱⡀⡀⠈⠿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠳⢳⡳⡳⡳⡺⣝⣝⣕
⢕⢹⣿⢿⣿⣾⡈⡲⢤⣉⣛⠛⠛⣻⣿⣿⢸⢬⡽⠶⣿⣿⣿⢿⣻⣛⡛⠿⣶⣬⣘⠵⢻⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡷⠻⣿⣿⣿⣿⣿⣿⣿⣿⡀⡀⡀⠘⢰⡿⡀⡀⠨⡀⡀⠉⠻⠿⣿⣿⣟⣺⣶⠟⣼⣷⠐⠁⠅⠄⡀⡀⠨⢀⢿⣿⣿⣿⣿⣿⣿⢿⣷⠙⢕⡪⢮⢮⢮⢵⡳
⠂⣿⠏⣂⢿⣿⣿⡘⡺⣫⢮⢮⢁⣿⠇⢗⡿⣫⣾⠟⡩⢔⡤⡛⣾⣟⣍⠶⣤⠙⣿⣮⠣⣿⣷⢿⣿⣿⣿⣿⣿⣿⣿⣿⢿⡹⣿⣿⣿⣿⣿⣿⣿⣷⡀⡀⡀⣿⠁⡀⡀⢀⡀⡀⡀⡀⢌⡀⡀⡆⢂⡐⠁⣿⣿⣷⠐⠅⡣⡀⡀⡀⣅⣦⠻⣿⣿⣿⣿⣿⣿⣿⣷⢳⡳⡺⣝⣝⣝⣕
*/
using ll = long long;
#define int long long
#define forn(i,n) for(int i=0; i<(n); ++i)
#define pb push_back
#define pi pair<int,int>
#define f first
#define s second
#define vii(a,n) vector<int> a(n); forn(i,n) cin>>a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
const ll inf = 1e18;
const ll mod = 998244353;
//types:
#define A 1 //ones to pop()
#define B 0 //ones to push()
struct DSU {
vector<int> p,sz,d,b;
int ans=0;
DSU() {}
DSU(int n) {
forn(i,n) p.pb(i),sz.pb(1),d.pb(0),b.pb(0);
}
int dist(int u) {
return p[u]==u ? 0 : (dist(p[u])^d[u]);
}
int get(int u) {
return p[u]==u ? u : get(p[u]);
}
struct node {
int u; //positive - new edge, negative - cycle
int oldans, oldb;
};
vector<node> rb;
void uni(int u, int v) {
int du=dist(u),dv=dist(v);
u=get(u),v=get(v);
if (u==v) {
rb.pb({-u,ans,b[u]});
b[u]|=du==dv;
ans|=b[u];
return;
}
if (sz[u] < sz[v]) swap(u,v);
rb.pb({v,ans,b[u]});
p[v]=u;
d[v]=du^dv^1;
sz[u]+=sz[v];
b[u]|=b[v];
}
void roll() {
auto it = rb.back(); rb.pop_back();
int u=it.u, oa=it.oldans, ob=it.oldb;
if (u < 0) {
ans = oa;
b[-u] = ob;
return;
}
int v=p[u];
sz[v]-=sz[u];
p[u]=u;
d[u]=0;
b[v]=ob;
}
};
struct q_dsu {
DSU dsu;
int size=0;
q_dsu(int n) {
dsu = DSU(n);
}
vector<pair<pi,int>> st;
void add(int u, int v, int type) {
dsu.uni(u,v); size+=type;
st.pb({{u,v},type});
}
void pop() {
vector<pair<pi,int>> nw,nw2;
while (st.size() && st.back().s==B) {
nw.pb(st.back());
st.pop_back();
}
int p=1;
assert(size);
while (!(size&p)) p<<=1; //least signif beat
assert(st.size() >= p);
forn(it,p) {
nw2.pb(st.back());
st.pop_back();
}
reverse(all(nw2));
forn(it,nw.size()+nw2.size()) dsu.roll();
for(auto&x:nw) {
st.pb(x);
dsu.uni(x.f.f,x.f.s);
}
for(auto&x:nw2) {
st.pb(x);
dsu.uni(x.f.f,x.f.s);
}
assert(st.back().s==A);
dsu.roll();
st.pop_back();
--size;
}
int query() {
return dsu.ans;
}
};
void solve() {
int n,m,q; cin>>n>>m>>q;
q_dsu dsu(n+1);
vector<pi> e(m);
forn(i,m) cin>>e[i].f>>e[i].s;
DSU check(n+1);
forn(i,m) check.uni(e[i].f,e[i].s);
if (!check.ans) {
forn(i,q) cout<<"NO\n"; return;
}
for(int i=m-1; i>0; --i) dsu.add(e[i].f,e[i].s,A);
vector<int> f(m);
int r=1;
for(int i=0; i<m-1; ++i) {
dsu.add(e[i].f,e[i].s,B);
while (r<m && dsu.query()) {
++r; dsu.pop();
}
f[i]=r-(dsu.query()^1);
}
vector<int> pr(m+1);
forn(i,m) pr[i+1]=max(pr[i],f[i]);
DSU z(n+1);
vector<int> sf(m+1);
for(int i=m-1; i>=0; --i) {
z.uni(e[i].f,e[i].s);
sf[i]=sf[i+1]|z.ans;
}
while (q--) {
int l,r; cin>>l>>r; --l, --r;
if (!l) cout<<(sf[r+1] ? "YES\n" : "NO\n");
else cout<<(pr[l]>r ? "YES\n" : "NO\n");
}
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t=1;
//cin>>t;
while (t--) solve();
return 0;
}
Compilation message
Joker.cpp:4:1: warning: multi-line comment [-Wcomment]
4 | // \ __ __ \
| ^
In file included from /usr/include/c++/10/cassert:44,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
from Joker.cpp:7:
Joker.cpp: In member function 'void q_dsu::pop()':
Joker.cpp:162:26: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
162 | assert(st.size() >= p);
| ~~~~~~~~~~^~~~
Joker.cpp:78:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
78 | #define forn(i,n) for(int i=0; i<(n); ++i)
| ^
Joker.cpp:168:9: note: in expansion of macro 'forn'
168 | forn(it,nw.size()+nw2.size()) dsu.roll();
| ^~~~
Joker.cpp: In function 'void solve()':
Joker.cpp:78:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
78 | #define forn(i,n) for(int i=0; i<(n); ++i)
| ^~~
Joker.cpp:197:9: note: in expansion of macro 'forn'
197 | forn(i,q) cout<<"NO\n"; return;
| ^~~~
Joker.cpp:197:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
197 | forn(i,q) cout<<"NO\n"; return;
| ^~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
600 KB |
Output is correct |
30 |
Correct |
2 ms |
864 KB |
Output is correct |
31 |
Correct |
2 ms |
860 KB |
Output is correct |
32 |
Correct |
2 ms |
860 KB |
Output is correct |
33 |
Correct |
2 ms |
856 KB |
Output is correct |
34 |
Correct |
2 ms |
860 KB |
Output is correct |
35 |
Correct |
2 ms |
860 KB |
Output is correct |
36 |
Correct |
2 ms |
860 KB |
Output is correct |
37 |
Correct |
2 ms |
860 KB |
Output is correct |
38 |
Correct |
1 ms |
604 KB |
Output is correct |
39 |
Correct |
2 ms |
1056 KB |
Output is correct |
40 |
Correct |
2 ms |
856 KB |
Output is correct |
41 |
Correct |
2 ms |
1112 KB |
Output is correct |
42 |
Correct |
2 ms |
860 KB |
Output is correct |
43 |
Correct |
2 ms |
856 KB |
Output is correct |
44 |
Correct |
2 ms |
928 KB |
Output is correct |
45 |
Correct |
2 ms |
880 KB |
Output is correct |
46 |
Correct |
2 ms |
860 KB |
Output is correct |
47 |
Correct |
2 ms |
860 KB |
Output is correct |
48 |
Correct |
2 ms |
860 KB |
Output is correct |
49 |
Correct |
2 ms |
860 KB |
Output is correct |
50 |
Correct |
2 ms |
876 KB |
Output is correct |
51 |
Correct |
2 ms |
860 KB |
Output is correct |
52 |
Correct |
2 ms |
860 KB |
Output is correct |
53 |
Correct |
2 ms |
860 KB |
Output is correct |
54 |
Correct |
2 ms |
984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
171 ms |
49248 KB |
Output is correct |
4 |
Correct |
48 ms |
27668 KB |
Output is correct |
5 |
Correct |
196 ms |
56952 KB |
Output is correct |
6 |
Correct |
180 ms |
49456 KB |
Output is correct |
7 |
Correct |
200 ms |
49592 KB |
Output is correct |
8 |
Correct |
185 ms |
43556 KB |
Output is correct |
9 |
Correct |
212 ms |
52008 KB |
Output is correct |
10 |
Correct |
247 ms |
61284 KB |
Output is correct |
11 |
Correct |
187 ms |
52960 KB |
Output is correct |
12 |
Correct |
221 ms |
59080 KB |
Output is correct |
13 |
Correct |
160 ms |
40436 KB |
Output is correct |
14 |
Correct |
188 ms |
45276 KB |
Output is correct |
15 |
Correct |
232 ms |
59136 KB |
Output is correct |
16 |
Correct |
247 ms |
58480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
171 ms |
49248 KB |
Output is correct |
30 |
Correct |
48 ms |
27668 KB |
Output is correct |
31 |
Correct |
196 ms |
56952 KB |
Output is correct |
32 |
Correct |
180 ms |
49456 KB |
Output is correct |
33 |
Correct |
200 ms |
49592 KB |
Output is correct |
34 |
Correct |
185 ms |
43556 KB |
Output is correct |
35 |
Correct |
212 ms |
52008 KB |
Output is correct |
36 |
Correct |
247 ms |
61284 KB |
Output is correct |
37 |
Correct |
187 ms |
52960 KB |
Output is correct |
38 |
Correct |
221 ms |
59080 KB |
Output is correct |
39 |
Correct |
160 ms |
40436 KB |
Output is correct |
40 |
Correct |
188 ms |
45276 KB |
Output is correct |
41 |
Correct |
232 ms |
59136 KB |
Output is correct |
42 |
Correct |
247 ms |
58480 KB |
Output is correct |
43 |
Correct |
164 ms |
50948 KB |
Output is correct |
44 |
Correct |
56 ms |
28016 KB |
Output is correct |
45 |
Correct |
190 ms |
62040 KB |
Output is correct |
46 |
Correct |
193 ms |
49424 KB |
Output is correct |
47 |
Correct |
192 ms |
49632 KB |
Output is correct |
48 |
Correct |
218 ms |
51984 KB |
Output is correct |
49 |
Correct |
250 ms |
63088 KB |
Output is correct |
50 |
Correct |
183 ms |
51464 KB |
Output is correct |
51 |
Correct |
203 ms |
57628 KB |
Output is correct |
52 |
Correct |
215 ms |
64376 KB |
Output is correct |
53 |
Correct |
164 ms |
45700 KB |
Output is correct |
54 |
Correct |
201 ms |
48128 KB |
Output is correct |
55 |
Correct |
225 ms |
59528 KB |
Output is correct |
56 |
Correct |
256 ms |
62020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
600 KB |
Output is correct |
30 |
Correct |
2 ms |
864 KB |
Output is correct |
31 |
Correct |
2 ms |
860 KB |
Output is correct |
32 |
Correct |
2 ms |
860 KB |
Output is correct |
33 |
Correct |
2 ms |
856 KB |
Output is correct |
34 |
Correct |
2 ms |
860 KB |
Output is correct |
35 |
Correct |
2 ms |
860 KB |
Output is correct |
36 |
Correct |
2 ms |
860 KB |
Output is correct |
37 |
Correct |
2 ms |
860 KB |
Output is correct |
38 |
Correct |
1 ms |
604 KB |
Output is correct |
39 |
Correct |
2 ms |
1056 KB |
Output is correct |
40 |
Correct |
2 ms |
856 KB |
Output is correct |
41 |
Correct |
2 ms |
1112 KB |
Output is correct |
42 |
Correct |
2 ms |
860 KB |
Output is correct |
43 |
Correct |
2 ms |
856 KB |
Output is correct |
44 |
Correct |
2 ms |
928 KB |
Output is correct |
45 |
Correct |
2 ms |
880 KB |
Output is correct |
46 |
Correct |
2 ms |
860 KB |
Output is correct |
47 |
Correct |
2 ms |
860 KB |
Output is correct |
48 |
Correct |
2 ms |
860 KB |
Output is correct |
49 |
Correct |
2 ms |
860 KB |
Output is correct |
50 |
Correct |
2 ms |
876 KB |
Output is correct |
51 |
Correct |
2 ms |
860 KB |
Output is correct |
52 |
Correct |
2 ms |
860 KB |
Output is correct |
53 |
Correct |
2 ms |
860 KB |
Output is correct |
54 |
Correct |
2 ms |
984 KB |
Output is correct |
55 |
Correct |
141 ms |
49412 KB |
Output is correct |
56 |
Correct |
56 ms |
28588 KB |
Output is correct |
57 |
Correct |
161 ms |
54780 KB |
Output is correct |
58 |
Correct |
143 ms |
46744 KB |
Output is correct |
59 |
Correct |
178 ms |
51640 KB |
Output is correct |
60 |
Correct |
215 ms |
53880 KB |
Output is correct |
61 |
Correct |
164 ms |
52264 KB |
Output is correct |
62 |
Correct |
190 ms |
56952 KB |
Output is correct |
63 |
Correct |
151 ms |
40664 KB |
Output is correct |
64 |
Correct |
187 ms |
49428 KB |
Output is correct |
65 |
Correct |
221 ms |
60020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
600 KB |
Output is correct |
30 |
Correct |
2 ms |
864 KB |
Output is correct |
31 |
Correct |
2 ms |
860 KB |
Output is correct |
32 |
Correct |
2 ms |
860 KB |
Output is correct |
33 |
Correct |
2 ms |
856 KB |
Output is correct |
34 |
Correct |
2 ms |
860 KB |
Output is correct |
35 |
Correct |
2 ms |
860 KB |
Output is correct |
36 |
Correct |
2 ms |
860 KB |
Output is correct |
37 |
Correct |
2 ms |
860 KB |
Output is correct |
38 |
Correct |
1 ms |
604 KB |
Output is correct |
39 |
Correct |
2 ms |
1056 KB |
Output is correct |
40 |
Correct |
2 ms |
856 KB |
Output is correct |
41 |
Correct |
2 ms |
1112 KB |
Output is correct |
42 |
Correct |
2 ms |
860 KB |
Output is correct |
43 |
Correct |
2 ms |
856 KB |
Output is correct |
44 |
Correct |
2 ms |
928 KB |
Output is correct |
45 |
Correct |
2 ms |
880 KB |
Output is correct |
46 |
Correct |
2 ms |
860 KB |
Output is correct |
47 |
Correct |
2 ms |
860 KB |
Output is correct |
48 |
Correct |
2 ms |
860 KB |
Output is correct |
49 |
Correct |
2 ms |
860 KB |
Output is correct |
50 |
Correct |
2 ms |
876 KB |
Output is correct |
51 |
Correct |
2 ms |
860 KB |
Output is correct |
52 |
Correct |
2 ms |
860 KB |
Output is correct |
53 |
Correct |
2 ms |
860 KB |
Output is correct |
54 |
Correct |
2 ms |
984 KB |
Output is correct |
55 |
Correct |
171 ms |
49248 KB |
Output is correct |
56 |
Correct |
48 ms |
27668 KB |
Output is correct |
57 |
Correct |
196 ms |
56952 KB |
Output is correct |
58 |
Correct |
180 ms |
49456 KB |
Output is correct |
59 |
Correct |
200 ms |
49592 KB |
Output is correct |
60 |
Correct |
185 ms |
43556 KB |
Output is correct |
61 |
Correct |
212 ms |
52008 KB |
Output is correct |
62 |
Correct |
247 ms |
61284 KB |
Output is correct |
63 |
Correct |
187 ms |
52960 KB |
Output is correct |
64 |
Correct |
221 ms |
59080 KB |
Output is correct |
65 |
Correct |
160 ms |
40436 KB |
Output is correct |
66 |
Correct |
188 ms |
45276 KB |
Output is correct |
67 |
Correct |
232 ms |
59136 KB |
Output is correct |
68 |
Correct |
247 ms |
58480 KB |
Output is correct |
69 |
Correct |
164 ms |
50948 KB |
Output is correct |
70 |
Correct |
56 ms |
28016 KB |
Output is correct |
71 |
Correct |
190 ms |
62040 KB |
Output is correct |
72 |
Correct |
193 ms |
49424 KB |
Output is correct |
73 |
Correct |
192 ms |
49632 KB |
Output is correct |
74 |
Correct |
218 ms |
51984 KB |
Output is correct |
75 |
Correct |
250 ms |
63088 KB |
Output is correct |
76 |
Correct |
183 ms |
51464 KB |
Output is correct |
77 |
Correct |
203 ms |
57628 KB |
Output is correct |
78 |
Correct |
215 ms |
64376 KB |
Output is correct |
79 |
Correct |
164 ms |
45700 KB |
Output is correct |
80 |
Correct |
201 ms |
48128 KB |
Output is correct |
81 |
Correct |
225 ms |
59528 KB |
Output is correct |
82 |
Correct |
256 ms |
62020 KB |
Output is correct |
83 |
Correct |
141 ms |
49412 KB |
Output is correct |
84 |
Correct |
56 ms |
28588 KB |
Output is correct |
85 |
Correct |
161 ms |
54780 KB |
Output is correct |
86 |
Correct |
143 ms |
46744 KB |
Output is correct |
87 |
Correct |
178 ms |
51640 KB |
Output is correct |
88 |
Correct |
215 ms |
53880 KB |
Output is correct |
89 |
Correct |
164 ms |
52264 KB |
Output is correct |
90 |
Correct |
190 ms |
56952 KB |
Output is correct |
91 |
Correct |
151 ms |
40664 KB |
Output is correct |
92 |
Correct |
187 ms |
49428 KB |
Output is correct |
93 |
Correct |
221 ms |
60020 KB |
Output is correct |
94 |
Correct |
190 ms |
55304 KB |
Output is correct |
95 |
Correct |
288 ms |
63680 KB |
Output is correct |
96 |
Correct |
186 ms |
59588 KB |
Output is correct |
97 |
Correct |
180 ms |
50112 KB |
Output is correct |
98 |
Correct |
199 ms |
51680 KB |
Output is correct |
99 |
Correct |
193 ms |
50340 KB |
Output is correct |
100 |
Correct |
246 ms |
66804 KB |
Output is correct |
101 |
Correct |
191 ms |
48912 KB |
Output is correct |
102 |
Correct |
207 ms |
57976 KB |
Output is correct |
103 |
Correct |
226 ms |
59560 KB |
Output is correct |
104 |
Correct |
183 ms |
43988 KB |
Output is correct |
105 |
Correct |
225 ms |
52760 KB |
Output is correct |
106 |
Correct |
275 ms |
58088 KB |
Output is correct |
107 |
Correct |
135 ms |
59804 KB |
Output is correct |
108 |
Correct |
182 ms |
52588 KB |
Output is correct |
109 |
Correct |
169 ms |
52904 KB |
Output is correct |
110 |
Correct |
183 ms |
50924 KB |
Output is correct |
111 |
Correct |
177 ms |
51872 KB |
Output is correct |
112 |
Correct |
176 ms |
50700 KB |
Output is correct |
113 |
Correct |
170 ms |
54172 KB |
Output is correct |
114 |
Correct |
171 ms |
50332 KB |
Output is correct |
115 |
Correct |
173 ms |
50080 KB |
Output is correct |
116 |
Correct |
185 ms |
53196 KB |
Output is correct |