QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#138517#4364. Ceiling FunctionPetroTarnavskyi#Compile Error//C++172.7kb2023-08-11 20:57:422023-08-11 20:57:43

Judging History

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

  • [2023-08-11 20:57:43]
  • 评测
  • [2023-08-11 20:57:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FILL(a, b) memset(a, b, sizeof(a))

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

string numb[7];
int a[7][21];
int b[7][21];
vector<vector<string>> v;
char ans[7][21];
VI st = {0, 5, 12, 17};

bool ok(int t, int n)
{
	
	FOR (i, 0, n)
	{
		int h = t / 60;
		int m = t % 60;
		VI vec = {h / 10, h % 10, m / 10, m % 10};
		FOR (j, 0, 7)
		{
			FOR (k, 0, 21)
			{
				if (a[j][k] != 3) continue;
				int idx = upper_bound(ALL(st), k) - st.begin() - 1;
				if (v[i][j][k] != numb[j][vec[idx] * 4 + k - st[idx]]) return false;
			}
		}
		t++;
		if (t >= 1440)
			t = 0;
	}
	return true;
	
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	numb[0] = ".XX......XX..XX......XX..XX..XX..XX..XX.";
	numb[1] = "X..X...X...X...XX..XX...X......XX..X...X";
	numb[2] = "X..X...X...X...XX..XX...X......XX..X...X";
	numb[3] = ".XX......XX..XX..XX..XX..XX......XX..XX.";
	numb[4] = "X..X...XX......X...X...XX..X...XX..X...X";
	numb[5] = "X..X...XX......X...X...XX..X...XX..X...X";
	numb[6] = ".XX......XX..XX......XX..XX......XX.....";
	
	int n;
	cin >> n;
	v = vector<vector<string>>(n, vector<string>(7));
	FOR (i, 0, n)
	{
		FOR (j, 0, 7) 
		{
			cin >> v[i][j];
			FOR (k, 0, 21)
				a[j][k] |= (1 << (v[i][j][k] == 'X'));
		}
	}
	int cnt = 0;
	FOR (T, 0, 1440)
	{
		if (ok(T, n))
		{
			cnt++;
			int t = T;
			FOR (i, 0, n)
			{
				int h = t / 60;
				int m = t % 60;
				VI vec = {h / 10, h % 10, m / 10, m % 10};
				FOR (idx, 0, 4)
				{
					FOR (j, 0, 7)
					{
						FOR (k, st[idx], st[idx] + 4)
						{
							if (numb[j][32 + k - st[idx]] == '.') continue;
							b[j][k] |= (1 << (numb[j][vec[idx] * 4 + k - st[idx]] == 'X'));
						}
					}
				}
				t++;
				if (t >= 1440)
					t = 0;
			}
		}
	}
	
	if (cnt == 0)
	{
		cout << "impossible\n";
		return 0;
	}
	
	FOR (j, 0, 7)
	{
		FOR (k, 0, 21)
		{
			ans[j][k] = '.';
		}
	}
	FOR (idx, 0, 4)
	{
		FOR (j, 0, 7)
		{
			FOR (k, st[idx], st[idx] + 4)
			{
				if (numb[j][32 + k - st[idx]] == '.') continue;
				if (a[j][k] == 3) ans[j][k] = 'W';
				else
				{
					if (b[j][k] == 3) ans[j][k] = '?';
					else if (v[0][j][k] == '.') ans[j][k] = '0';
					else ans[j][k] = '1';
				}
			}
		}
	}
	
	if ()
	
	FOR (i, 0, 7)
	{
		FOR (j, 0, 21) cout << ans[i][j];
		cout << '\n';
	}
	
	return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:136:13: error: expected primary-expression before ‘)’ token
  136 |         if ()
      |             ^