QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21692 | #2827. Autobiography | gogo# | Compile Error | / | / | C++20 | 1.6kb | 2022-03-08 14:13:28 | 2022-05-18 04:11:58 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-05-18 04:11:58]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-03-08 14:13:28]
- 提交
answer
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i <= (r); i ++)
#define per(i, r, l) for(int i = (r); i >= (l); i --)
#define trv(i, u, v) for(int i = head[u], v = e[i].to; i; v = e[i = e[i].nxt].to)
#define fi first
#define se second
#define all(s) s.begin(), s.end()
#define sz(s) (int)(s.size())
#define lb(s) ((s) & -(s))
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
mt19937_64 hua(time(0));
template<typename T> inline bool chkmx(T &x, T y) {return x < y ? x = y, 1 : 0;}
template<typename T> inline bool chkmn(T &x, T y) {return y < x ? x = y, 1 : 0;}
template<int T> using A = array<int, T>;
inline int read() {
int x = 0, f = 1; char c = getchar();
for(; !isdigit(c); c = getchar()) if(c == '-') f = 0;
for(; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return f ? x : -x;
}
const int maxn = 2e5;
int n, m, c[maxn + 5];
vector<int> g[maxn + 5];
char s[maxn + 5];
int u[maxn + 5], v[maxn + 5];
int main() {
// freopen("in.txt", "r", stdin);
while(cin >> n >> m) {
rep(i, 1, n) g[i].clear();
cin >> s + 1;
rep(i, 1, n) c[i] = s[i] - 'a';
rep(i, 1, m) {
u[i] = read(), v[i] = read();
g[u[i]].pb(c[v[i]]);
g[v[i]].pb(c[u[i]]);
}
rep(i, 1, n) sort(all(g[i]));
ll ans = 0;
rep(i, 1, m) {
if(c[u[i]] == c[v[i]]) continue;
int cnta = upper_bound(all(g[u[i]]), c[v[i]]) - lower_bound(all(g[u[i]]), c[v[i]]) - 1;
int cntb = upper_bound(all(g[v[i]]), c[u[i]]) - lower_bound(all(g[v[i]]), c[u[i]]) - 1;
ans += 1ll * cnta * cntb;
}
cout << ans << '\n';
}
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:35:13: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’) 35 | cin >> s + 1; | ~~~ ^~ ~~~~~ | | | | | char* | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:168:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match) 168 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/11/istream:168:7: note: conversion of argument 1 would be ill-formed: answer.code:35:18: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’ 35 | cin >> s + 1; | ~~^~~ In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:172:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match) 172 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/11/istream:172:7: note: conversion of argument 1 would be ill-formed: answer.code:35:18: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive] 35 | cin >> s + 1; | ~~^~~ | | | char* answer.code:35:18: error: cannot bind rvalue ‘(short int)(((char*)(& s)) + 1)’ to ‘short int&’ In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:175:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match) 175 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/11/istream:175:7: note: conversion of argument 1 would be ill-formed: answer.code:35:18: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive] 35 | cin >> s + 1; | ~~^~~ | | | char* answer.code:35:18: error: cannot bind rvalue ‘(short unsigned int)(((char*)(& s)) + 1)’ to ‘short unsigned int&’ In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:179:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match) 179 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/11/istream:179:7: note: conversion of argument 1 would be ill-formed: answer.code:35:18: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive] 35 | cin >> s + 1; | ~~^~~ | | | char* answer.code:35:18: error: cannot bind rvalue ‘(int)(((char*)(& s)) + 1)’ to ‘int&’ In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:182:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match) 182 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/11/istream:182:7: note: conversion of argument 1 would be ill-formed: answer.code:35:18: error: invalid conversion fr...