QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#842837 | #9968. Just Zeros | ucup-team3510# | Compile Error | / | / | C++20 | 1.1kb | 2025-01-04 15:10:05 | 2025-01-04 15:10:09 |
Judging History
answer
#include<iostream>
using namespace std;
int n,m,q,S[100010],f[1<<8],del=0;
char s[100010];
bool a[10][100010];
inline void add(int x,int v)
{
for(int i=0;i<(1<<n);i++)
{
int t=__builtin_popcount(x^i);
f[i]+=v*min(t,n-t+1);
}
}
inline int solve()
{
int ans=1e9;
for(int i=0;i<(1<<n);i++)
{
ans=min(ans,f[i]+
__builtin_popcount(i^del));
}
return ans;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>m>>q;
for(int i=1;i<=n;i++)
{
cin>>s+1;
for(int j=1;j<=m;j++)
{
a[i][j]=s[j]-'0';
}
}
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
{
S[i]|=(1<<j-1)*a[j][i];
}
add(S[i],1);
}
cout<<solve()<<'\n';
while(q--)
{
char op;
int x;
cin>>op>>x;
if(op=='P')
{
int y;
cin>>y;
a[x][y]^=1;
add(S[y],-1),S[y]=0;
for(int i=1;i<=n;i++)
{
S[y]|=(1<<i-1)*a[i][y];
}
add(S[y],1);
}
if(op=='R')
{
del^=1<<x-1;
}
if(op=='K')
{
add(S[x],-1),S[x]=0;
for(int i=1;i<=n;i++)
{
a[i][x]^=1;
S[x]|=(1<<i-1)*a[i][x];
}
add(S[x],1);
}
cout<<solve()<<'\n';
}
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:31:20: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’) 31 | cin>>s+1; | ~~~^~~~~ | | | | | char* | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/13/iostream:42, from answer.code:1: /usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 325 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/13/istream:325:7: note: conversion of argument 1 would be ill-formed: answer.code:31:23: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’ 31 | cin>>s+1; | ~^~ /usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 201 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:201:7: note: conversion of argument 1 would be ill-formed: answer.code:31:23: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive] 31 | cin>>s+1; | ~^~ | | | char* answer.code:31:23: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& s)) + 1)’ to ‘long long unsigned int&’ /usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 197 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:197:7: note: conversion of argument 1 would be ill-formed: answer.code:31:23: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive] 31 | cin>>s+1; | ~^~ | | | char* answer.code:31:23: error: cannot bind rvalue ‘(long long int)(((char*)(& s)) + 1)’ to ‘long long int&’ /usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:192:7: note: conversion of argument 1 would be ill-formed: answer.code:31:23: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive] 31 | cin>>s+1; | ~^~ | | | char* answer.code:31:23: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& s)) + 1)’ to ‘long unsigned int&’ /usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:188:7: note: conversion of argument 1 would be ill-formed: answer.code:31:23: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive] 31 | cin>>s+1; | ~^~ | | | char* answer.code:31:23: error: cannot bind rvalue ‘(long int)(((char*)(& s)) + 1)’ to ‘long int&’ /usr/include/c++/13/istream:184: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>; __istream_type = std::basic_istream<char>]’ (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/13/istream:184:7: note: conversion of argument 1 would be ill-formed: answer.code:31:23: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive] 31 | cin>>s+1; | ~^~ | | | char* answer.code:31:23: error: cannot bind rvalue ‘(unsigned int)(((char*)(& s)) + 1)’ to ‘unsigned int&’ /usr/include/c++/13/istream:181:7: note: candidate: ‘std::basic_istre...