QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#213488#3016. Flashing FluorescentsrbjwnbCompile Error//C++201.2kb2023-10-14 14:29:122023-10-14 14:29:12

Judging History

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

  • [2023-10-14 14:29:12]
  • 评测
  • [2023-10-14 14:29:12]
  • 提交

answer

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int N = 1e2+5, M = 1e6+5;
const int MOD = 998244353, INF = 0x3f3f3f3f;
string r, c;
bool ans[N][N];
deque<int> res;
void solve() {
	cin >> r >> c;
	for(int i = 0; i < r.size(); i ++) {
		for(int j = 0; j < c.size(); j ++) ans[i][j] = true;
		if((c.size() % 2) != (r[i] - '0')) res.push_back(i);
	}
	deque<int> t;
	int j = 0;
	for(int i = 0; i < c.size(); i ++) {
		if((r.size() % 2) != (c[i] - '0')) {
			t.push_back(i);
		}
	}
	if(abs(t.size() - res.size()) % 2 == 1) {
		cout << -1 << endl;
		return ;
	}
	while(res.size() < t.size()) {
		res.push_front(0);
	}
	while(t.size() < res.size()) {
		t.push_front(0);
	}
	for(int i = 0; i < t.size(); i ++) {
		ans[res[i]][t[i]] = false;
	}
	for(int i = t.size(); i < res.size(); i ++) ans[res[i]][0] = false;
	for(int i = 0; i < r.size(); i ++) {
		for(int j = 0; j < c.size(); j ++) cout << ans[i][j];
		cout << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	int t = 1;
	//cin >> t;
	while(t --) solve();
	
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:24:15: error: call of overloaded ‘abs(std::deque<int>::size_type)’ is ambiguous
   24 |         if(abs(t.size() - res.size()) % 2 == 1) {
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/std_abs.h:38,
                 from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:1:
/usr/include/stdlib.h:840:12: note: candidate: ‘int abs(int)’
  840 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:1:
/usr/include/c++/11/bits/std_abs.h:79:3: note: candidate: ‘constexpr long double std::abs(long double)’
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:75:3: note: candidate: ‘constexpr float std::abs(float)’
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:71:3: note: candidate: ‘constexpr double std::abs(double)’
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~