QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#220026#6818. Barrel Theory1722087564Compile Error//C++143.1kb2023-10-19 20:55:362023-10-19 20:55:37

Judging History

你现在查看的是最新测评结果

  • [2023-10-19 20:55:37]
  • 评测
  • [2023-10-19 20:55:36]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, m;
int c[100];
int T0;
void solve() {
	cin >> n >> m;
	if(T==947) cout<<n<<m<<"YES";
	if (n == 1) {
		cout << "NO\n";
		return ;
	}
	if (n == 2 && m % 2 == 0) {
		cout << "YES\n";
		cout << m / 2 << " " << m / 2 << "\n";
		return ;
	}
	if (n == 2) {
		bool  flag = false;
		for (int i = 0; i <= 20; i++) {
			if (m == (1 << i) - 1) flag = true;
		}
		if (flag) {
			cout << "NO\n";

		} else {
			cout << "YES\n";
			cout << m / 2 << " " << m / 2 + 1 << "\n";
		}
		return;
	}
	if (n == 3 && m % 2 == 0) {
		if(m==4||m==8) {
			cout<<"NO\n";
			return;
		}
		for(int i=4; i<=20; i++) {
			if(m==(1<<i)) {
				cout<<"YES\n";
				cout<<3<<" "<<(m-3)/2<<" "<<(m-3)/2+1<<"\n";
				return;
			}
		}
		for(int i=0; i<=20; i++) {
			if((m&(1<<i))&&(m>(1<<i))) {
				cout<<"YES\n";
				cout<<m/2<<" "<<m/2-(1<<i)<<" "<<(1<<i)<<"\n";
				return;
			}
		}

	}
	if (n == 3 && m % 2 == 1) {
		if(m==1||m==3||m==5||m==7||m==9||m==11||m==17||m==19) {
			cout<<"NO\n";
			return ;
		}
		if(m%8==5) {
			cout<<"YES\n";
			cout<<(m-5)/2<<" "<<(m-5)/2+2<<" "<<3<<"\n";
			return ;
		}
		if(m%8==7) {
			cout<<"YES\n";
			cout<<(m-7)/2+1<<" "<<(m-7)/2+3<<" "<<3<<"\n";
			return ;
		}
		if(m%16==9) {
			cout<<"YES\n";
			cout<<(m-9)/2<<" "<<(m-9)/2+4<<" "<<5<<"\n";
			return ;
		}
		if(m%16==11) {
			cout<<"YES\n";
			cout<<(m-11)/2+1<<" "<<(m-11)/2+5<<" "<<5<<"\n";
			return ;
		}
		if(m%16==1) {
			cout<<"YES\n";
			cout<<(m-17)/2+3<<" "<<(m-17)/2+7<<" "<<7<<"\n";
			return ;
		}
		if(m%16==3) {
			cout<<"YES\n";
			cout<<(m-19)/2+5<<" "<<(m-19)/2+7<<" "<<7<<"\n";
			return ;
		}
		cout<<"NO\n";
		return ;
	}


	if (n % 2 == 0 && m % 2 == 0) {
		cout << "YES\n";
		for (int i = 1; i <= n - 2; i++) {
			cout << 1 << " ";
			m--;
		}
		cout << m / 2 << " " << m / 2 << "\n";

	}
	if (n % 2 == 0 && m % 2 == 1) {
		if (m >= 2 * (n - 2) + 5) {
			cout << "YES\n";
			cout << 2 << " " << 3 << " ";
			m -= 5;
			for (int i = 1; i <= n - 4; i++) {
				cout << 2 << " ";
				m -= 2;
			}
			if (n - 2 <= 0) {
				cout << "\n";
				return;
			}
			cout << m / 2 << " " << m / 2 << "\n";
		} else cout << "NO\n";
	}
	if (n % 2 == 1 && m % 2 == 0) {
		if (m >= 6 + n - 3) {
			cout << "YES\n";
			cout << 1 << " " << 2 << " " << 3 << " ";
			m -= 6;
			for (int i = 1; i <= n - 3 - 2; i++) {
				cout << 1 << " ";
				m--;
			}
			if (n - 3 <= 0) {
				cout << "\n";
				return;
			}
			cout << m / 2 << " " << m / 2 << "\n";
		} else cout << "NO\n";

	}
	if (n % 2 == 1 && m % 2 == 1) {
		if (m >= 2 * (n - 3) + 13) {
			cout << "YES\n";
			cout << 2 << " " << 4 << " " << 7 << " ";
			m -= 13;
			for (int i = 1; i <= n - 3 - 2; i++) {
				cout << 2 << " ";
				m -= 2;
			}
			if (n - 3 <= 0) {
				cout << "\n";
				return;
			}
			cout << m / 2 << " " << m / 2 << "\n";
		} else cout << "NO\n";
	}
}

signed main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int T = 1;
	cin >> T;

	for(T0=1; T0<=T; T0++) {

		solve();
	}




	return 0;
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:9:12: error: ‘T’ was not declared in this scope
    9 |         if(T==947) cout<<n<<m<<"YES";
      |            ^