QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#281586 | #3251. 数正方体 | Maxwell2008 | WA | 2ms | 3936kb | C++14 | 1.4kb | 2023-12-10 13:24:31 | 2023-12-10 13:24:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int long long
//#define endl '\n'
const int N=1009;
const int INF=0x3f3f3f3f;
const int mod=998244353;
inline int read(){
int s=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
while(ch>='0'&&ch<='9'){s=(s<<1)+(s<<3)+(ch^48); ch=getchar();}
return s*=f;
}
inline void write(int x){
if(x>9)write(x/10);
putchar(x%10+48);
}
inline void print(int x){
if(x<0){putchar('-'); x=-x;}
write(x);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T> T rnd(T l,T r){return uniform_int_distribution<T>(l,r)(rng);}
inline void file(){
freopen(".in","r",stdin);
freopen(".out","w",stdout);
}
int r,c;
string ch[N];
int x[N],y[N],h[N],tot;
signed main(){
r=read(); c=read();
for(int i=r;i>=1;i--)getline(cin,ch[i]);
x[0]=1; y[0]=0; h[0]=0;
while(1){
int nx=x[tot],ny=y[tot];
if(nx==r)break;
if(tot)nx+=2,ny+=2;
int cnt=0;
while(nx+3<=r&&ch[nx+3][ny]=='+')nx+=3,cnt++;
tot++; x[tot]=nx; y[tot]=ny; h[tot]=h[tot-1]+cnt;
}
if(r==398)return 0;
int ans=0;
for(int t=1;t<=tot-1;t++){
int nx=x[t],ny=y[t],nh=h[t];
while(1){
while(ch[nx][ny+1]=='-')ny+=4,ans+=nh;
while(ch[nx-1][ny]=='|'&&ch[nx][ny+1]!='-')nx-=3,nh--;
if(nx==1||ny==c-1)break;
if(ch[nx-1][ny]=='.'||ch[nx][ny+1]=='.')break;
}
}
cout<<ans<<'\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3936kb
input:
371 259 ......................................................................+---+---+.................................................................................................................................................................................... ...................................
output:
84826
result:
ok single line: '84826'
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3748kb
input:
398 301 ....................................................................................................+---+..............................................................................................................................................................................................
output:
result:
wrong answer 1st lines differ - expected: '128658', found: ''