QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#830771 | #8891. Hipster Jazz | edogawa_something# | 0 | 8ms | 8028kb | C++23 | 1.5kb | 2024-12-24 22:41:41 | 2024-12-24 22:41:48 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define all(v) v.begin(),v.end()
const ll M=5e5+10;
const ll inf=2e18;
const ll mod=1e9+7;
ll pow(ll x,ll y,ll mod=mod){
x%=mod;
ll res=1;
while(y>0){
if((y&1)>0)
res*=x,res%=mod;
x*=x,x%=mod;
y/=2;
}
return res;
}
ll n,m,c[M],vis[M],mat[300][300];
vii adj[M];
void dfs(ll x,ll col=0){
c[x]=col;
vis[x]=1;
for(auto it:adj[x]){
if(!vis[it])
dfs(it,(col^1));
}
}
int main(){
ios_base::sync_with_stdio(0),cin.tie(0);
ll TC=1;
//cin>>TC;
while(TC--){
cin>>n>>m;
for(int i=0;i<m;i++){
ll x,y;
cin>>x>>y;
mat[x][y]=mat[y][x]=1;
adj[x].pb(y),adj[y].pb(x);
}
for(int i=0;i<n;i++){
if(!vis[i])
dfs(0);
}
for(int k=0;k<n;k++){
for(int i=0;i<n;i++){
ll cnt=0;
for(int j=0;j<n;j++){
if(j==i)
continue;
if(c[j]!=c[i]&&mat[j][i])
cnt++;
}
if(cnt<(adj[i].size()+1)/2){
c[i]=(c[i]^1);
}
}
}
for(int i=0;i<n;i++){
if(c[i]==0)
cout<<'P';
else
cout<<'S';
}
cout<<'\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 0ms
memory: 5708kb
input:
1 0
output:
P
result:
ok correct
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 7748kb
input:
2 1 2 1
output:
PP
result:
wrong answer Student 0 has 1 friends playing same instrument, 0 play other
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 2ms
memory: 7804kb
input:
7 10 7 4 5 3 6 5 5 2 5 1 2 1 6 2 7 5 7 6 7 3
output:
PSPSSPS
result:
wrong answer Student 3 has 1 friends playing same instrument, 0 play other
Subtask #3:
score: 0
Wrong Answer
Test #29:
score: 0
Wrong Answer
time: 8ms
memory: 8028kb
input:
200 10000 1 101 1 102 1 103 1 104 1 105 1 106 1 107 1 108 1 109 1 110 1 111 1 112 1 113 1 114 1 115 1 116 1 117 1 118 1 119 1 120 1 121 1 122 1 123 1 124 1 125 1 126 1 127 1 128 1 129 1 130 1 131 1 132 1 133 1 134 1 135 1 136 1 137 1 138 1 139 1 140 1 141 1 142 1 143 1 144 1 145 1 146 1 147 1 148 1 ...
output:
PSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
result:
wrong answer Student 0 has 99 friends playing same instrument, 1 play other
Subtask #4:
score: 0
Wrong Answer
Test #40:
score: 0
Wrong Answer
time: 6ms
memory: 7992kb
input:
200 10000 1 131 66 3 132 193 97 25 53 198 166 25 77 27 108 162 187 46 18 39 147 158 147 116 16 139 172 169 38 15 16 50 60 133 29 105 88 105 170 179 156 139 49 70 53 10 189 82 165 145 137 75 17 162 32 103 200 35 164 75 184 10 49 52 197 103 41 121 111 151 184 57 189 68 185 23 100 95 31 195 55 163 134 ...
output:
PPPSSPPPSPPPPSPSSPPSSPSSSPSPSPSPSSPPSSSSPSPSPSSPSSPPPSSPPSSSSPSPPPSSPSSPPSPPSSPSSSSSSPSSPPSSPSPSPSSSSPPPSSPPSSSSSPSSSSSSPPSSPPPSSSSPSPPPPSPSPPSPPSPPPSPPPSPPSSSPPPPSSPSPSSSPSSPPPPPPPPPPSPSPPPPPSPSPPSPP
result:
wrong answer Student 0 has 54 friends playing same instrument, 46 play other