QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#149097 | #2331. Innovative Alignment | sakuya726 | AC ✓ | 2ms | 5112kb | C++14 | 2.5kb | 2023-08-24 00:31:06 | 2023-08-24 00:31:08 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define maxn 215
#define ll long long
#define IT set<node>::iterator
#define int ll
#pragma GCC optimize(3)
#pragma -fcrossjumping
#pragma -fdefer-pop
#pragma -fmerge-constans
#pragma -fthread-jumps
#pragma -floop-optimize
#pragma -fif-conversion
#pragma -fif-conversion2
#pragma -fdelayed-branch
#pragma -fguess-branch-probability
#pragma -fcprop-registers
#pragma -fforce-mem
#pragma -foptimize-sibling-calls
#pragma -fstrength-reduce
#pragma -fgcse
#pragma -fcse-follow-jumps
#pragma -frerun-cse-after-loop
#pragma -fdelete-null-pointer-checks
#pragma -fextensive-optimizations
#pragma -fregmove
#pragma -fschedule-insns
#pragma -fsched-interblock
#pragma -fcaller-saves
#pragma -fpeephole2
#pragma -freorder-blocks
#pragma -fstrict-aliasing
#pragma -funit-at-a-time
#pragma -falign-functions
#pragma -fcrossjumping
#pragma -finline-functions
#pragma -fweb
#pragma -fgcse-after-reload
inline int read()
{
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-') f=-1;
c=getchar();
}
while(c<='9'&&c>='0')
{
x=(x<<1)+(x<<3)+(c^48);
c=getchar();
}
return x*f;
}
inline int max(int a,int b)
{
if(a>b) return a;
return b;
}
int n;
string s[maxn];
int ans[maxn][maxn],maxx;
int blk[maxn],num[maxn][maxn];
string c[maxn][maxn];
inline void pre_work()
{
for(rg int i=1;i<=n;++i)
{
ans[i][1]=0;
int tot=0,cnt=0,st=0;
for(rg int j=0;j<s[i].length();++j)
{
if(s[i][j]==' ')
{
tot++;
num[i][tot]=cnt;
c[i][tot]=s[i].substr(st,cnt);
cnt=0;
st=j+1;
}
else cnt++;
}
blk[i]=tot+1;
maxx=max(maxx,blk[i]);
num[i][blk[i]]=cnt;
c[i][tot+1]=s[i].substr(st,cnt);
}
}
int now_word=1,st;
signed main()
{
n=read();
for(rg int i=1;i<=n;++i) getline(cin,s[i]);
pre_work();
while(now_word<=maxx)
{
int maxnum=0;
for(rg int i=1;i<=n;++i)
{
if(blk[i]<now_word) continue;
maxnum=max(maxnum,num[i][now_word]);
}
now_word++;
for(rg int i=1;i<=n;++i) ans[i][now_word]=st+(maxnum+1);
st+=(maxnum+1);
}
for(rg int i=1;i<=n;++i)
{
int temp=0;
// cout<<"i="<<i<<" blk="<<blk[i]<<endl;
for(rg int j=1;j<=blk[i];++j)
{
// cout<<ans[i][j]<<" "<<num[i][j]<<endl;
cout<<c[i][j];
temp+=num[i][j];
while(temp<ans[i][j+1])
{
cout<<" ";
++temp;
}
}
cout<<endl;
// system("Pause");
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 4868kb
input:
2 Hello World UoI IPL
output:
Hello World UoI IPL
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 4928kb
input:
3 Align my life plz CTCI sucks Welcome to check in
output:
Align my life plz CTCI sucks Welcome to check in
result:
ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 4908kb
input:
1 a
output:
a
result:
ok
Test #4:
score: 0
Accepted
time: 2ms
memory: 4876kb
input:
1 a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa
output:
a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa
result:
ok
Test #5:
score: 0
Accepted
time: 2ms
memory: 5104kb
input:
5 G hash ekas kfsdajfk as j kjsfda asd sdaf k a asfd fdsa f ksda asksda sdaf kj sa dsfa assasa fsda sfda as fd fs sa jk fsd werkwe weqop qpp wri wreq wrewrewwe ppwqe rqwe rwe
output:
G hash ekas kfsdajfk as j kjsfda asd sdaf k a asfd fdsa f ksda asksda sdaf kj sa dsfa assasa fsda sfda as fd fs sa jk fsd werkwe weqop qpp wri wreq wrewrewwe ppwqe rqwe rwe
result:
ok
Test #6:
score: 0
Accepted
time: 2ms
memory: 5108kb
input:
7 ksjda wreuiwreur rwe pt REW rqwe JK asdfj ssfda FK FDSMN FDSBBBBB aewr a rew zxcv nrewjh FSDIEWR rb qwer rweqb sadsa rwe j rweq rj q qwre r i p rewq as brtwbre REWIP fdasnFDSEe treui wae qwre rweq sa r rqwe rwe wer wq qq er t y rweqru rweq
output:
ksjda wreuiwreur rwe pt REW rqwe JK asdfj ssfda FK FDSMN FDSBBBBB aewr a rew zxcv nrewjh FSDIEWR rb qwer rweqb sadsa rwe j rweq rj q qwre r i p rewq as brtwbre REWIP fdasnFDSEe treui wae qwre rweq sa ...
result:
ok
Test #7:
score: 0
Accepted
time: 2ms
memory: 5060kb
input:
9 uwrqeiRE qrwu REEIUREW e E ERE Efsdaa ER Lo ipsum dolor sit amet conctetur adipiscing elit Proin elementu entumgd ornare In ultricies sa Morb sit amet tortor diam Quisque filisis e odio In hac habitsse platea dictumst dRQ FK RQW d mi tristie eficitur risus s adsf fsda ADFS FF kgsd relative gsfd fs...
output:
uwrqeiRE qrwu REEIUREW e E ERE Efsdaa ER Lo ipsum dolor sit amet conctetur adipiscing elit Proin elementu entumgd ornare In ultricies sa Morb sit amet tortor diam Quisque filisis e odio In hac ...
result:
ok
Test #8:
score: 0
Accepted
time: 1ms
memory: 4916kb
input:
8 ewr wer j e suada Donec dignissim an sfd sfda a f d e a fe ea sua da onec g nissim n fjeawk ARE AQ REWQ E Q Vest ibulum in arcu vel erat fring illa veh ic b lum i n arcu veWAE GS af
output:
ewr wer j e suada Donec dignissim an sfd sfda a f d e a fe ea sua da onec g nissim n fjeawk ARE AQ REWQ E Q Vest ibulum in arcu vel erat fring illa veh ic b lum i n arcu ...
result:
ok
Test #9:
score: 0
Accepted
time: 2ms
memory: 4920kb
input:
4 fa we rwqewrerq fas we a rfdask RE E E fdsa a seawr ER wer ags ER awfas f er q ewq wreq RERW ewq fasER
output:
fa we rwqewrerq fas we a rfdask RE E E fdsa a seawr ER wer ags ER awfas f er q ewq wreq RERW ewq fasER
result:
ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 5112kb
input:
10 aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa ...
output:
aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa a...
result:
ok
Test #11:
score: 0
Accepted
time: 2ms
memory: 5080kb
input:
10 aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaa...
output:
aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa a...
result:
ok
Test #12:
score: 0
Accepted
time: 2ms
memory: 5080kb
input:
10 a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa a aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa a aa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa a aa aaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaa...
output:
a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa a aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa a...
result:
ok