submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s930940122 | p03746 | C | #include <stdio.h>
int main(void){
int n, m;
scanf("%d %d", &n, &m);
int a[m], b[m], g[n+1][n+1], c[n+1];
for(int i=0; i<=n; i++){
for(int j=0; j=<n; j++){
g[i][j]=0;
}
c[i]=0;
}
for(int i=0; i<m; i++){
scanf("%d %d", &a[i], &b[i]);
g[a[i]][b[i]]=1;
g[b[i]][a[i]]=1;
c[a[i]]++;
c[b[i]]++;
}
//FR
for(int i=1; i<n+1; i++){
if(c[i]==1){
for(int j=1; j<n+1; j++){
if(g[i][j]==1){
printf("2\n%d %d\n", i, j);
return 0;
}
}
}
}
//printf("");
return 0;
}
| main.c: In function 'main':
main.c:8:24: error: expected expression before '<' token
8 | for(int j=0; j=<n; j++){
| ^
|
s722056084 | p03746 | C | #include <stdio.h>
#include <string.h>
#define MaxSize 100000
char neighbour[MaxSize][MaxSize];
char visited[MaxSize];
char nbCount[MaxSize];
int startPath[MaxSize];
int endPath[MaxSize];
int startPathLen = 0;
int endPathLen = 0;
void searchEnd(int end, int pathArr[], int * pLength) {
char allNbSearched = 0;
char foundNew = 0;
while(!foundNew && !allNbSearched) {
for(int i = 0; i < nbCount[end]; i++) {
int newEnd = neighbour[end][i];
if(!visited[newEnd]) {
end = newEnd;
visited[newEnd] = 1;
foundNew = 1;
allNbSearched = 0;
pathArr[*pLength] = newEnd;
(*pLength)++;
break; //for
}
}
allNbSearched = 1;
}
}
int main(int argc, const char * argv[]) {
int N, M;
memset(neighbour, 0, MaxSize * MaxSize);
memset(visited, 0, MaxSize);
memset(nbCount, 0, MaxSize);
scanf("%d%d", &N, &M);
int start = -1, end = -1;
for(int i = 1; i < M; i++) {
scanf("%d%d", &start, &end);
neighbour[start][nbCount[start]] = end;
neighbour[end][nbCount[end]] = start;
nbCount[start]++;
nbCount[end]++;
}
visited[start] = visited[end] = 1;
searchEnd(start, startPath, &startPathLen);
searchEnd(end, endPath, &endPathLen);
printf("%d\n", startPathLen + endPathLen + 2);
for(int i = 0; i < startPathLen; i++)
printf("%d ", startPath[i]);
printf("%d %d ", start, end);
for(int i = 0; i < endPathLen; i++)
printf("%d ", endPath[i]);
printf("\n");
return 0;
} | main.c: In function 'main':
main.c:33:34: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
33 | memset(neighbour, 0, MaxSize * MaxSize);
| ^
/tmp/cczSm0OR.o: in function `searchEnd':
main.c:(.text+0x58): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `nbCount' defined in .bss section in /tmp/cczSm0OR.o
/tmp/cczSm0OR.o: in function `main':
main.c:(.text+0x11b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x134): relocation truncated to fit: R_X86_64_PC32 against symbol `nbCount' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `nbCount' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x1dc): relocation truncated to fit: R_X86_64_PC32 against symbol `nbCount' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x20d): relocation truncated to fit: R_X86_64_PC32 against symbol `nbCount' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x21f): relocation truncated to fit: R_X86_64_PC32 against symbol `nbCount' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `nbCount' defined in .bss section in /tmp/cczSm0OR.o
main.c:(.text+0x241): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s008456071 | p03746 | C | #include <stdio.h>
#define MaxSize 100000
char neighbour[MaxSize][MaxSize];
char visited[MaxSize];
char nbCount[MaxSize];
int startPath[MaxSize];
int endPath[MaxSize];
int startPathLen = 0;
int endPathLen = 0;
void searchEnd(int end, int pathArr[], int * pLength) {
char allNbSearched = 0;
char foundNew = 0;
while(!foundNew && !allNbSearched) {
for(int i = 0; i < nbCount[end]; i++) {
int newEnd = neighbour[end][i];
if(!visited[newEnd]) {
end = newEnd;
visited[newEnd] = 1;
foundNew = 1;
allNbSearched = 0;
pathArr[*pLength] = newEnd;
(*pLength)++;
break; //for
}
}
allNbSearched = 1;
}
}
int main(int argc, const char * argv[]) {
int N, M;
memset(neighbour, 0, MaxSize * MaxSize);
memset(visited, 0, MaxSize);
memset(nbCount, 0, MaxSize);
scanf("%d%d", &N, &M);
int start = -1, end = -1;
for(int i = 1; i < M; i++) {
scanf("%d%d", &start, &end);
neighbour[start][nbCount[start]] = end;
neighbour[end][nbCount[end]] = start;
nbCount[start]++;
nbCount[end]++;
}
visited[start] = visited[end] = 1;
searchEnd(start, startPath, &startPathLen);
searchEnd(end, endPath, &endPathLen);
printf("%d\n", startPathLen + endPathLen + 2);
for(int i = 0; i < startPathLen; i++)
printf("%d ", startPath[i]);
printf("%d %d ", start, end);
for(int i = 0; i < endPathLen; i++)
printf("%d ", endPath[i]);
printf("\n");
return 0;
}
| main.c: In function 'main':
main.c:32:5: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
32 | memset(neighbour, 0, MaxSize * MaxSize);
| ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'memset'
1 | #include <stdio.h>
+++ |+#include <string.h>
2 | #define MaxSize 100000
main.c:32:5: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
32 | memset(neighbour, 0, MaxSize * MaxSize);
| ^~~~~~
main.c:32:5: note: include '<string.h>' or provide a declaration of 'memset'
main.c:32:34: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
32 | memset(neighbour, 0, MaxSize * MaxSize);
| ^
|
s583922432 | p03746 | C++ | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define pb push_back
#define pii pair<int,int>
using namespace std;
int n,m,num,ima;
vector<vector<int> > g;
vector<int> vis;
vector<int> res,tmp;
vector<pii> p;
void dfs(int doko){
int i;
//cout<<doko<<" ";
tmp.pb(doko);
vis[doko]=1;
for(i=0;i<g[ima].size();i++){
if(doko==g[ima][i]){
num--;
break;
}
}
//cout<<"("<<doko<<" "<<num<<")";
if(num==0){
copy(tmp.begin(),tmp.end(),back_inserter(res));
return;
}
for(i=0;i<g[doko].size();i++){
if(vis[g[doko][i]]==0) dfs(g[doko][i]);
if(num==0) return;
}
tmp.pop_back();
vis[doko]=0;
for(i=0;i<g[ima].size();i++){
if(doko==g[ima][i]){
num++;
break;
}
}
}
int main(void){
cin>>n>>m;
int x,y,i;
vis.resize(n+1);
for(i=0;i<=n;i++){
vector<int> b;
g.pb(b);
vis[i]=0;
}
for(i=0;i<m;i++){
cin>>x>>y;
g[x].pb(y);
g[y].pb(x);
}
for(i=1;i<=n;i++){
p.pb(pii(g[i].size(),i));
}
sort(p.begin(),p.end());
for(i=0;i<n;i++){
num=g[p[i].second].size();
ima=p[i].second;
for(j=0;j<=n;j++){
vis[j]=0;
}
dfs(p[i].second);
//cout<<endl;
if(res.size()>0) break;
}
cout<<res.size()<<endl;
for(i=0;i<res.size();i++){
cout<<res[i];
if(i==res.size()-1)cout<<endl;
else cout<<" ";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:66:9: error: 'j' was not declared in this scope
66 | for(j=0;j<=n;j++){
| ^
|
s649112455 | p03746 | C++ | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
const int MAXN=1e5+10;
vector<int> v[MAXN];
int vis[MAXN], path[MAXN], tag[MAXN], ans=0, e=0;
void dfs(int x){
e=x;
vis[x]=1;
for(int i=0; i<v[x].size(); i++){
int p=v[x][i];
if(!vis[p]){
dfs(p);
path[x]=p;
ans++;
}
}
}
int main(void){
int n, m;
cin >> n >> m;
while(m--){
int x, y;
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
for(int i=1; i<=n; i++){
ans=0;
memset(path, 0, sizeof(path));
memset(vis, 0, sizeof(vis));
memset(tag, 0, sizeof(tag));
dfs(i);
int gg=i;
while(gg){
tag[gg]=1;
gg=path[gg];
}
bool flag1=true, flag2=true;
for(int j=0; j<v[i].size(); j++){
if(!tag[v[i][j]]){
flag=false;
break;
}
}
for(int j=0; j<v[e].size(); j++){
if(!tag[v[e][j]]){
flag=false;
break;
}
}
if(ans>=2&&(flag1||flag2)){
int cc=i;
cout << ans+1 << endl;
while(cc){
cout << cc << " ";
cc=path[cc];
}
cout << endl;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:17: error: 'flag' was not declared in this scope; did you mean 'flag2'?
46 | flag=false;
| ^~~~
| flag2
a.cc:52:17: error: 'flag' was not declared in this scope; did you mean 'flag2'?
52 | flag=false;
| ^~~~
| flag2
|
s540319215 | p03746 | C++ | #include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
int N,M;
cin >> N >> M;
int a;
for(int i=0; i < 2*M)
cin >> a;
cout << 1 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:23: error: expected ';' before ')' token
15 | for(int i=0; i < 2*M)
| ^
| ;
|
s235055305 | p03746 | C++ | #include <iostream>
#include <vector>
using namespace std;
int N, M;
bool Use[100005];
vector <int> G[100005];
int Father[100005];
int leaf;
int Level[100005];
vector <int> Leaf;
vector <int> Sol, Sol2;
void Read()
{
cin >> N >> M;
for(int i = 1; i <= M; i++)
{
int x, y;
cin >> x >> y;
G[x].push_back(y);
G[y].push_back(x);
}
}
void DFS(int node, int father)
{
Use[node] = 1;
int cnt = 0;
Father[node] = father;
Level[node] = Level[father] + 1;
for(int i = 0; i < G[node].size(); i++)
{
int neighb = G[node][i];
if(Use[neighb] == 1)
continue;
++cnt;
DFS(neighb, node);
}
if(cnt == 0)
Leaf.push_back(node);
}
void Print()
{
int node1 = Leaf[0];
while(node1 != 1)
{
Sol.push_back(node1);
node1 = Father[node1];
}
Sol.push_back(1);
if(Leaf.size() > 1)
{
int node2 = Leaf[1];
while(node2 != 1)
{
Sol2.push_back(node2);
node2 = Father[node2];
}
}
cout << Sol.size() + Sol2.size() << "\n";
reverse(Sol2.begin(), Sol2.end());
for(int i = 0; i < Sol.size(); i++)
cout << Sol[i] << " ";
for(int i = 0; i < Sol2.size(); i++)
cout << Sol2[i] << " ";
}
int main()
{
Read();
DFS(1, 0);
Print();
return 0;
}
| a.cc: In function 'void Print()':
a.cc:63:5: error: 'reverse' was not declared in this scope
63 | reverse(Sol2.begin(), Sol2.end());
| ^~~~~~~
|
s634481893 | p03746 | C++ | #include <iostream>
#include <vector>
using namespace std;
int N, M;
bool Use[100005];
vector <int> G[100005];
int Father[100005];
int leaf;
int Level[100005];
vector <int> Leaf;
vector <int> Sol, Sol2;
void Read()
{
cin >> N >> M;
for(int i = 1; i <= M; i++)
{
int x, y;
cin >> x >> y;
G[x].push_back(y);
G[y].push_back(x);
}
}
void DFS(int node, int father)
{
Use[node] = 1;
int cnt = 0;
Father[node] = father;
Level[node] = Level[father] + 1;
for(int i = 0; i < G[node].size(); i++)
{
int neighb = G[node][i];
if(Use[neighb] == 1)
continue;
++cnt;
DFS(neighb, node);
}
if(cnt == 0)
Leaf.push_back(node);
}
void Print()
{
int node1 = Leaf[0];
while(node1 != 1)
{
Sol.push_back(node1);
node1 = Father[node1];
}
Sol.push_back(1);
if(Leaf.size() > 1)
{
int node2 = Leaf[1];
while(node2 != 1)
{
Sol2.push_back(node2);
node2 = Father[node2];
}
}
cout << Sol.size() + Sol2.size() << "\n";
reverse(Sol2.begin(), Sol2.end());
for(int i = 0; i < Sol.size(); i++)
cout << Sol[i] << " ";
for(int i = 0; i < Sol2.size(); i++)
cout << Sol2[i] << " ";
}
int main()
{
Read();
DFS(1, 0);
Print();
return 0;
}
| a.cc: In function 'void Print()':
a.cc:63:5: error: 'reverse' was not declared in this scope
63 | reverse(Sol2.begin(), Sol2.end());
| ^~~~~~~
|
s094917540 | p03746 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 100010;
const int inf = 0x0fffffff;
#define LL long long
const long long mod = 1000000007;
vector <int> edge[maxn];
bool vis[maxn];
bool dfs(int v, vector<int> &path)
{
vis[v] = true;
path.push_back(v);
for (int i = 0; i < edge[v].size(); i ++)
if (!vis[edge[v][i]])
{
return dfs(edge[v][i], path);
}
return true;
}
int main()
{
int n, i, m, v, w;
vector<int> path1, path2;
path1.clear();
path2.clear();
cin >> n >> m;
for (i = 0; i < m; i ++)
{
cin >> v >> w;
edge[v].push_back(w);
edge[w].push_back(v);
}
memset(vis, false, sizeof(vis));
for (v = 1; v <= n; v ++)
if (edge[v].size() > 0)
{
dfs(v, path1);
for (int i = 0; i < edge[v].size(); i ++)
if (!vis[edge[v][i]])
dfs(edge[v][i], path2);
break;
}
cout << path1.size() + path2.size() << endl;
for (i = path2.size() - 1; i >= 0; i --)
cout << path2[i] << " ";
for (i = 0; i < path1.size(); i ++)
cout << path1[i] << " ";
return 0;
} | a.cc: In function 'int main()':
a.cc:40:9: error: 'memset' was not declared in this scope
40 | memset(vis, false, sizeof(vis));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <algorithm>
+++ |+#include <cstring>
5 | using namespace std;
|
s771525876 | p03746 | C++ | #include <iostream>
#include <vector>
using namespace std;
int N,M;
int mat[100000][100000] = {0};
vector<int> ans;
int visited[100000] = {0};
void DFS(int v)
{
ans.push_back(v+1);
visited[v] = 1;
for(int i=0;i<N;i++){
if(mat[v][i]==1 && visited[i]==0){
DFS(i);
return;
}
}
return;
}
int main()
{
cin >> N >> M;
for(int i=0;i<M;i++){
int a,b;
cin >> a >> b;
a--; b--;
mat[a][b] = mat[b][a] = 1;
}
DFS(0);
cout << ans.size() << endl;
for(int i=0;i<ans.size();i++){
cout << ans[i] << " ";
}
cout << endl;
return 0;
} | /tmp/ccv4BT3Y.o: in function `DFS(int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccv4BT3Y.o
a.cc:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccv4BT3Y.o
a.cc:(.text+0x8a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccv4BT3Y.o
/tmp/ccv4BT3Y.o: in function `main':
a.cc:(.text+0x1c5): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccv4BT3Y.o
a.cc:(.text+0x209): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccv4BT3Y.o
a.cc:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccv4BT3Y.o
/tmp/ccv4BT3Y.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x28b): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccv4BT3Y.o
a.cc:(.text+0x2a4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccv4BT3Y.o
collect2: error: ld returned 1 exit status
|
s623588764 | p03746 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
using namespace std;
int n,m,a,b;
vector<int> v[100010];
bool vis[100010];
stack<int> st,cop;
bool DFS(int x,int find,int not){
vis[x]=1,st.push(x);
if(x==find)return true;
for(int i=0;i<v[x].size();i++){
if(!vis[v[x][i]]&&v[x][i]!=not){
if(DFS(v[x][i],find,not)){
return true;
}
}
}
vis[x]=0,st.pop();
return false;
}
int main(){
cin>>n>>m;
for(int i=0;i<m;i++){
cin>>a>>b;a--,b--;
v[a].push_back(b);
v[b].push_back(a);
}
vector<int> tan;
vector<pair<int,int> >pir,mem;
for(int i=0;i<n;i++){
if(v[i].size()==1)tan.push_back(i);
if(v[i].size()==2){
if(v[v[i][0]].size()==2){
int r=v[v[i][0]][0];
if(r==i)r=v[v[i][0]][1];
pir.push_back(make_pair(v[i][1],r));
mem.push_back(make_pair(i,v[i][0]));
}
if(v[v[i][1]].size()==2){
int r=v[v[i][1]][0];
if(r==i)r=v[v[i][1]][1];
pir.push_back(make_pair(v[i][0],r));
mem.push_back(make_pair(i,v[i][1]));
}
}
}
for(int i=0;i<tan.size();i++){
for(int j=i+1;j<tan.size();j++){
pir.push_back(make_pair(tan[i],tan[j]));
mem.push_back(make_pair(-1,-1));
}
}
for(int i=0;i<pir.size();i++){
//cout<<"#"<<i<<" "<<pir[i].first<<" "<<pir[i].second<<endl;
if(mem[i].first>-1)st.push(mem[i].first);
if(DFS(pir[i].first,pir[i].second,pir[i].first)){
if(mem[i].second>-1)st.push(mem[i].second);
break;
}
while(!st.empty())st.pop();
}
while(!st.empty())cop.push(st.top()),st.pop();
bool f=0;
cout<<cop.size()<<endl;
while(!cop.empty()){
if(f)cout<<" ";
cout<<cop.top()+1;
cop.pop();
f=1;
}
cout<<endl;
return 0;
} | a.cc:13:29: error: expected ',' or '...' before 'not' token
13 | bool DFS(int x,int find,int not){
| ^~~
a.cc: In function 'bool DFS(int, int, int)':
a.cc:18:47: error: expected primary-expression before ')' token
18 | if(!vis[v[x][i]]&&v[x][i]!=not){
| ^
a.cc:19:48: error: expected primary-expression before ')' token
19 | if(DFS(v[x][i],find,not)){
| ^
|
s014353758 | p03746 | C++ | #include <cstdio>
#define R register
#define maxn 100010
struct Edge {
Edge *next;
int to;
}*last[maxn], e[maxn << 1], *ecnt = e;
int deg[maxn];
inline void link(R int a, R int b)
{
++deg[a]; ++deg[b];
*++ecnt = (Edge) {last[a], b}; last[a] = ecnt;
*++ecnt = (Edge) {last[b], a}; last[b] = ecnt;
}
bool vis[maxn];
int ans[maxn], ac;
void dfs(R int x)
{
vis[x] = 1; ans[++ac] = x;
for (R Edge *iter = last[x]; iter; iter = iter -> next)
if (!vis[iter -> to])
{
dfs(iter -> to);
return ;
}
}
int main()
{
R int n, m; scanf("%d%d", &n, &m);
for (R int i = 1; i <= m; ++i)
{
R int a, b; scanf("%d%d", &a, &b);
link(a, b);
}
for (R int i = 1; i <= n; ++i)
if (deg[i] & 1)
{
dfs(i);
printf("%d\n", ac);
for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
return 0;
}
dfs(rand() % n + 1);
printf("%d\n", ac);
for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
return 0;
} | a.cc:10:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10 | inline void link(R int a, R int b)
| ^
a.cc:10:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10 | inline void link(R int a, R int b)
| ^
a.cc:18:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
18 | void dfs(R int x)
| ^
a.cc: In function 'void dfs(int)':
a.cc:21:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
21 | for (R Edge *iter = last[x]; iter; iter = iter -> next)
| ^~~~
a.cc: In function 'int main()':
a.cc:30:15: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
30 | R int n, m; scanf("%d%d", &n, &m);
| ^
a.cc:30:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
30 | R int n, m; scanf("%d%d", &n, &m);
| ^
a.cc:31:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
31 | for (R int i = 1; i <= m; ++i)
| ^
a.cc:33:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | R int a, b; scanf("%d%d", &a, &b);
| ^
a.cc:33:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | R int a, b; scanf("%d%d", &a, &b);
| ^
a.cc:36:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
36 | for (R int i = 1; i <= n; ++i)
| ^
a.cc:41:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
41 | for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
| ^
a.cc:44:13: error: 'rand' was not declared in this scope
44 | dfs(rand() % n + 1);
| ^~~~
a.cc:46:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
46 | for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
| ^
|
s539521682 | p03746 | C++ | #include <cstdio>
#define R register
#define maxn 100010
struct Edge {
Edge *next;
int to;
}*last[maxn], e[maxn << 1], *ecnt = e;
int deg[maxn];
inline void link(R int a, R int b)
{
++deg[a]; ++deg[b];
*++ecnt = (Edge) {last[a], b}; last[a] = ecnt;
*++ecnt = (Edge) {last[b], a}; last[b] = ecnt;
}
bool vis[maxn];
int ans[maxn], ac;
void dfs(R int x)
{
vis[x] = 1; ans[++ac] = x;
for (R Edge *iter = last[x]; iter; iter = iter -> next)
if (!vis[iter -> to])
{
dfs(iter -> to);
return ;
}
}
int main()
{
R int n, m; scanf("%d%d", &n, &m);
for (R int i = 1; i <= m; ++i)
{
R int a, b; scanf("%d%d", &a, &b);
link(a, b);
}
for (R int i = 1; i <= n; ++i)
if (deg[i] == 1)
{
dfs(i);
printf("%d\n", ac);
for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
return 0;
}
dfs(rand() % n + 1);
printf("%d\n", ac);
for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
return 0;
} | a.cc:10:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10 | inline void link(R int a, R int b)
| ^
a.cc:10:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10 | inline void link(R int a, R int b)
| ^
a.cc:18:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
18 | void dfs(R int x)
| ^
a.cc: In function 'void dfs(int)':
a.cc:21:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
21 | for (R Edge *iter = last[x]; iter; iter = iter -> next)
| ^~~~
a.cc: In function 'int main()':
a.cc:30:15: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
30 | R int n, m; scanf("%d%d", &n, &m);
| ^
a.cc:30:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
30 | R int n, m; scanf("%d%d", &n, &m);
| ^
a.cc:31:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
31 | for (R int i = 1; i <= m; ++i)
| ^
a.cc:33:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | R int a, b; scanf("%d%d", &a, &b);
| ^
a.cc:33:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | R int a, b; scanf("%d%d", &a, &b);
| ^
a.cc:36:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
36 | for (R int i = 1; i <= n; ++i)
| ^
a.cc:41:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
41 | for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
| ^
a.cc:44:13: error: 'rand' was not declared in this scope
44 | dfs(rand() % n + 1);
| ^~~~
a.cc:46:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
46 | for (R int i = 1; i <= ac; ++i) printf("%d ", ans[i]);
| ^
|
s174670496 | p03746 | C++ | #include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define s second
#define f first
#define mk make_pair
bool a[100001][100001],used[100001];
int n,m;
main(){
cin>>n>>m;
r(i,m){
int p1,p2;
cin>>p1>>p2;
a[p1][p2]=a[p2][p1]=1;
}
queue<int>l;
queue<int>q;
r(j,n){r(i,n+1)used[i]=0;
used[j+1]=1;
q.push(j+1);
int b[n+1]={0},p,bb[n+1]={0};
r(i,n)if(a[i+1][j+1])b[i+1]=1;
while(!q.empty()){
p=q.front();q.pop();
l.push(p);
r(i,n){
if(a[p][i+1]){
if(!used[i+1]){
used[i+1]=1;
q.push(i+1);goto L;
}
}
}L:;
}
int ccc=0;
r(i,n)if(a[i+1][p])bb[i+1]=1;
r(i,n)if(b[i+1]||bb[i+1]){
if(!used[i+1])ccc++;
}
if(!ccc)goto PP;
while(!q.empty())q.pop();
while(!l.empty())l.pop();
}PP:;
cout<<l.size()<<endl;int cc=0;
while(!l.empty()){
if(cc)cout<<' ';
cout<<l.front();l.pop();
cc++;
}
} | a.cc:9:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
9 | main(){
| ^~~~
/tmp/cckV7qmJ.o: in function `main':
a.cc:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x143): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x157): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x180): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x2cd): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x35a): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cckV7qmJ.o
a.cc:(.text+0x374): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s910428221 | p03746 | C++ | #include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define s second
#define f first
#define mk make_pair
int a[100001][100001],used[100001];
int n,m;
main(){
cin>>n>>m;
r(i,m){
int p1,p2;
cin>>p1>>p2;
a[p1][p2]=a[p2][p1]=1;
}
queue<int>l;
queue<int>q;
r(j,n){r(i,n+1)used[i]=0;
used[j+1]=1;
q.push(j+1);
int b[n+1]={0},p,bb[n+1]={0};
r(i,n)if(a[i+1][j+1])b[i+1]=1;
while(!q.empty()){
p=q.front();q.pop();
l.push(p);
r(i,n){
if(a[p][i+1]){
if(!used[i+1]){
used[i+1]=1;
q.push(i+1);goto L;
}
}
}L:;
}
int ccc=0;
r(i,n)if(a[i+1][p])bb[i+1]=1;
r(i,n)if(b[i+1]||bb[i+1]){
if(!used[i+1])ccc++;
}
if(!ccc)goto PP;
while(!q.empty())q.pop();
while(!l.empty())l.pop();
}PP:;
cout<<l.size()<<endl;int cc=0;
while(!l.empty()){
if(cc)cout<<' ';
cout<<l.front();l.pop();
cc++;
}
} | a.cc:9:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
9 | main(){
| ^~~~
/tmp/cc2fxpfI.o: in function `main':
a.cc:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x151): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x17e): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x1aa): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x22a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x2fc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x399): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cc2fxpfI.o
a.cc:(.text+0x3b7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s947969196 | p03746 | C++ | #include<cstdio>
using namespace std;
int a[100005],b[100005];
int main(){
int n,m,i;
scanf("%d%d",&n,&m);
for(i=0;i<m;i++){
scanf("%d%d",&a[i],&b[i]);
}
printf("2\n%d %d\n",a[0],b[0]);
} | a.cc: In function 'int main()':
a.cc:7:16: error: expected ')' before '\U0000ff09'
7 | for(i=0;i<m;i++){
| ~ ^~
| )
a.cc:7:16: error: '\U0000ff09' was not declared in this scope
7 | for(i=0;i<m;i++){
| ^~
|
s851817579 | p03746 | C++ | #include<cstdio>
int a[100005],b[100005];
int main(){
int n,m,i;
scanf("%d%d",&n,&m);
for(i=0;i<m;i++){
scanf("%d%d",&a[i],&b[i]);
}
printf("2\n%d %d\n",a[0],b[0]);
} | a.cc: In function 'int main()':
a.cc:6:16: error: expected ')' before '\U0000ff09'
6 | for(i=0;i<m;i++){
| ~ ^~
| )
a.cc:6:16: error: '\U0000ff09' was not declared in this scope
6 | for(i=0;i<m;i++){
| ^~
|
s764798751 | p03746 | C++ | #include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define s second
#define f first
#define mk make_pair
int n,m;
int main(){
cin>>n>>m;
int a[n+1][n+1]={0};
r(i,m){
int p1,p2;
cin>>p1>>p2;
a[p1][p2]=a[p2][p1]=1;
}
r(i,n){
r(j,n){
if(a[i+1][j+1]){
cout<<2<<endl<<i+1<<''<<j+1<<endl;
return 0;
}
}
}
} | a.cc:20:53: error: empty character constant
20 | cout<<2<<endl<<i+1<<''<<j+1<<endl;
| ^~
|
s842990203 | p03746 | C++ | #include <bits/stdc++.h>
using namespace std;
#ifdef WIN32
#define lld "%I64d"
#else
#define lld "%lld"
#endif
#define mp make_pair
#define pb push_back
#define put(x) { cout << #x << " = "; cout << (x) << endl; }
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef double db;
const int M = 1e6 + 15;
const int Q = 1e9 + 7;
vector<int> ans;
int used[M];
vector<int> g[M];
void dfs(int v) {
used[v] = 1;
ans.pb(v);
for (auto u : g[v]) {
if (!used[u]) {
dfs(u);
return;
}
}
}
int main() {
srand(time(NULL));
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin.tie(0);
ios_base::sync_with_stdio(0);
int n;
int m;
cin >> n >> m;
int v1 = -1 v2 = -1;
for (int i = 0; i < m; i++) {
int ai, bi;
cin >> ai >> bi;
g[ai].pb(bi);
g[bi].pb(ai);
v1 = ai, v2= bi;
}
used[v1] = used[v2] = 1;
dfs(v1);
reverse(ans.begin(), ans.end());
dfs(v2);
cout << (int)ans.size() << endl;
for (auto u : ans)
cout << u << " ";
return 0;
} | a.cc: In function 'int main()':
a.cc:49:21: error: expected ',' or ';' before 'v2'
49 | int v1 = -1 v2 = -1;
| ^~
a.cc:55:26: error: 'v2' was not declared in this scope; did you mean 'v1'?
55 | v1 = ai, v2= bi;
| ^~
| v1
a.cc:59:25: error: 'v2' was not declared in this scope; did you mean 'v1'?
59 | used[v1] = used[v2] = 1;
| ^~
| v1
|
s936676355 | p03746 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin >> n >> m;
vector<vi> gr(n);
vi deg(n);
rep(_,0,m){
int a,b;
cin >> a >> b;
--a, --b;
gr[a].push_back(b);
gr[b].push_back(a);
++deg[a], ++deg[b];
}
vector<bool> vis(n);
vis[0] = 1;
deque<int> path(1,0);
trav(u, gr[0]) --deg[u];
rep(_,0,2){
while(deg[path.back()]){
int v = path.back();
trav(u, gr[v]) if(!vis[u]){
vis[u] = 1;
trav(w, gr[u]) --deg[w];
path.push_back(u);
break;
}
}
reverse(all(path));
}
cout << sz(path) << endl;
trav(x, path) cout << x+1 << ' ';
cout << endl;
} | a.cc:29:15: error: extended character is not valid in an identifier
29 | vis[0] = 1;
| ^
a.cc: In function 'int main()':
a.cc:29:15: error: expected ';' before '\U000000a0'
29 | vis[0] = 1;
| ^
| ;
a.cc:29:14: warning: ignoring return value of 'std::vector<bool, _Alloc>::reference std::vector<bool, _Alloc>::operator[](size_type) [with _Alloc = std::allocator<bool>; reference = std::vector<bool>::reference; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
29 | vis[0] = 1;
| ^
In file included from /usr/include/c++/14/vector:67,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_bvector.h:1086:7: note: declared here
1086 | operator[](size_type __n)
| ^~~~~~~~
|
s068546207 | p03747 | C++ | #include <bits/stdc++.h>
#define f first
#define s second
#define int long long
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr int MN = 1e5+5;
pair<ii, int> A[MN];
ii pos[MN];
int ans[MN];
main() {
if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
ios_base::sync_with_stdio(0), cin.tie(0);
int N, L, T; cin >> N >> L >> T;
for (int i = 0; i < N; ++i) {
cin >> A[i].f.f >> A[i].f.s;
if (A[i].f.s == 2) A[i].f.s = -1;
A[i].s = i;
}
for (int i = 0; i < N; ++i) pos[i] = ii((A[i].f.f+((ll)L+A[i].f.s)*T)%L, A[i].s);
sort(A, A+N), sort(pos, pos+N);
int cnt = 0;
for (int i = 0; i < N; ++i) {
if (A[i].f.s != A[0].f.s) {
int d = (A[i].f.f*A[i].f.s-A[0].f.f*A[0].f.s+2*L)%L;
cnt += max((2*T-d)/L+1, 0);
}
}
int c = ((ll)(N+A[0].f.s)*cnt%N);
int idx = find(pos, pos+N, ii((A[0].f.f+((ll)L+A[0].f.s)*T)%L, A[0].s))-pos;
for (int i = 0; i < N; ++i) ans[A[(i+c)%N].s] = pos[(i+idx)%N].f;
for (int i = 0; i < N; ++i) cout << ans[i] << '\n';
}
| a.cc:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:32:35: error: no matching function for call to 'max(long long int, int)'
32 | cnt += max((2*T-d)/L+1, 0);
| ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:32:35: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
32 | cnt += max((2*T-d)/L+1, 0);
| ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:32:35: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
32 | cnt += max((2*T-d)/L+1, 0);
| ~~~^~~~~~~~~~~~~~~~
|
s772507266 | p03747 | Java | import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.util.Arrays;
import lib.io.ExtendedScanner;
import lib.io.Out;
public class Main {
public static void main(String[] args) throws Exception {
Field f = System.out.getClass().getDeclaredField("autoFlush");
f.setAccessible(true);
f.set(System.out, false);
execute(System.in, System.out);
}
public static void execute(InputStream in, OutputStream out) {
ExtendedScanner s = new ExtendedScanner(in);
Out o = new Out(out);
solve(s, o);
o.flush();
o.close();
}
public static void solve(ExtendedScanner sc, Out out) {
int n = sc.nextInt();
int l = sc.nextInt();
int t = sc.nextInt();
int[] x = new int[n];
boolean[] clk = new boolean[n];
int m = 0;
int v = -1;
for (int i = 0; i < n; i++) {
x[i] = sc.nextInt();
clk[i] = sc.nextInt() == 1;
if (!clk[i]) m++;
else v = i;
}
int col = 0;
if (0 < m && m < n) {
int[] rvs = new int[m];
for (int i = 0, idx = 0; i < n; i++) {
if (!clk[i]) {
rvs[idx++] = v > i ? x[i] - x[v] + l : x[i] - x[v];
}
}
Arrays.sort(rvs);
for (int j = 0; j < m; j++) {
long ll = -1, rr = 2 * t + 1;
while (rr - ll > 1) {
long mm = (ll + rr) >> 1;
if (2 * t > rvs[j] + mm * l) ll = mm;
else rr = mm;
}
col += rr % n;
if (col >= n) col -= n;
}
}
int dv = (x[(v - col + n) % n] + t) % l;
int[] dst = new int[n];
for (int i = 0; i < n; i++) {
if (clk[i]) {
dst[i] = (x[i] + t) % l;
} else {
dst[i] = (x[i] - t) % l;
if (dst[i] < 0) dst[i] += l;
}
dst[i] -= dv;
if (dst[i] < 0) dst[i] += l;
}
Arrays.sort(dst);
for (int i = 0; i < n; i++) {
out.writeln((dst[(i + n - v) % n] + dv) % l);
}
}
}
| Main.java:6: error: package lib.io does not exist
import lib.io.ExtendedScanner;
^
Main.java:7: error: package lib.io does not exist
import lib.io.Out;
^
Main.java:25: error: cannot find symbol
public static void solve(ExtendedScanner sc, Out out) {
^
symbol: class ExtendedScanner
location: class Main
Main.java:25: error: cannot find symbol
public static void solve(ExtendedScanner sc, Out out) {
^
symbol: class Out
location: class Main
Main.java:18: error: cannot find symbol
ExtendedScanner s = new ExtendedScanner(in);
^
symbol: class ExtendedScanner
location: class Main
Main.java:18: error: cannot find symbol
ExtendedScanner s = new ExtendedScanner(in);
^
symbol: class ExtendedScanner
location: class Main
Main.java:19: error: cannot find symbol
Out o = new Out(out);
^
symbol: class Out
location: class Main
Main.java:19: error: cannot find symbol
Out o = new Out(out);
^
symbol: class Out
location: class Main
8 errors
|
s658815798 | p03747 | C++ | #include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
if(a>b){
a = b; return true;
}
else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
if(a<b){
a = b; return true;
}
else return false;
}
template<typename T> inline void print(T &a){
rep(i,a.size()) cout << a[i] << " ";
cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;
int main(){
ll n,L,t; cin >> n >> L >> t;
vector<vpl> v(2);
rep(i,n){
ll x,w; cin >> x >> w; w--;
v[w].emplace_back(x,i);
v[w].emplace_back(x+L,i);
}
rep(i,2) sort(all(v[i]));
ll inc = t / L;
t %= L;
vl ans(n);
for(auto i : v[0]){
if(i.first >= L) break;
auto itr = lower_bound(all(v[1]), P(i.first+2*t, -inf));
auto itr2 = lower_bound(all(v[1]), P(i.first, -inf));
ll id = i.second + (itr-itr2) + inc * v[1].size();
if(i.first+2*t >= 2*L){
id += lower_bound(all(v[1]),P(i.first+2*t-2*L), -inf) - v[1].begin();
}
ans[id%n] = (t + i.first) % L;
}
for(auto i : v[1]){
if(i.first < L) continue;
ll tmp = i.first - 2*t;
ll d;
if(tmp >= 0){
auto itr = lower_bound(all(v[0]), P(i.first, -inf));
d = itr - upper_bound(all(v[0]), P(tmp, inf));
}else{
d = lower_bound(all(v[0]), P(i.first, -inf)) - v[0].begin();
d += v[0].end() - upper_bound(all(v[0]), P(2*L+tmp, inf));
}
d += inc * v[0].size();
d %= n;
ans[(i.second-d+3*n)%n] = (i.first - t) % L;
//cout << (i.second-d+n)%n << "\n";
}
rep(i,n) cout << ans[i] << "\n";
} | a.cc: In function 'int main()':
a.cc:83:70: error: no matching function for call to 'std::pair<long long int, long long int>::pair(long long int)'
83 | id += lower_bound(all(v[1]),P(i.first+2*t-2*L), -inf) - v[1].begin();
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<long long int, _U2>::value)), long long int, long long int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<long long int, _U2>::value)), long long int, long long int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = long long int]'
913 | explicit constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:913:28: note: template argument deduction/substitution failed:
a.cc:83:70: note: mismatched types 'std::pair<_T1, _T2>' and 'long long int'
83 | id += lower_bound(all(v[1]),P(i.first+2*t-2*L), -inf) - v[1].begin();
| ^
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<long long int, _U2>::value)), long long int, long long int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<long long int, _U2>::value)), long long int, long long int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = long long int]'
902 | constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:902:19: note: template argument deduction/substitution failed:
a.cc:83:70: note: mismatched types 'std::pair<_T1, _T2>' and 'long long int'
83 | id += lower_bound(all(v[1]),P(i.first+2*t-2*L), -inf) - v[1].begin();
| ^
/usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = long long int]'
891 | explicit constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = long long int]'
881 | constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<long long int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<long long int, _U1>, std::__not_<std::is_constructible<long long int, const _U1&> >, std::__not_<std::is_convertible<_Iter, long long int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = long long int]'
869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<long long int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<long long int, _U1>, std::__not_<std::is_constructible<long long int, const _U1&> >, std::is_convertible<_Iter, long long int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = long long int]'
856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<long long int>, std::is_constructible<long long int, _U1>, std::__not_<std::is_constructible<long long int, const _U1&> >, std::__not_<std::is_convertible<_Iter, long long int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_Iter, _Iterator> > >::value, bool>::type <anonymous> = _U1; _T1 = long long int; _T2 = long long int]'
843 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<long long int>, std::is_constructible<long long int, _U1>, std::__not_<std::is_constructible<long long int, const _U1&> >, std::is_convertible<_Iter, long long int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_Iter, _Iterator> >::value, bool>::type <anonymous> = _U1; _T1 = long long int; _T2 = long long int]'
830 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:789:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<long long int, _U2>::value)), long long int, long long int>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<long long int, _U2>::value)), long long int, long long int>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = long long int]'
789 | explicit constexpr pair(const pair<_U1, _U2>& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:789:28: note: template argument deduction/substitution failed:
a.cc:83:70: note: mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
83 | id += lower_bound(all(v[1]),P(i.first+2*t-2*L), -inf) - v[1].begin();
| |
s482836142 | p03747 | C++ | #include<bits/stdc++.h>
const int maxn = 100035;
int a[maxn],n,l,t,x,cnt;
int main()
{
scanf("%d%d%d",&n,&l,&t);
for (int i=1; i<=n; i++)
{
scanf("%d%d",&a[i],&x);
a[i] += x==1?t:-t;
cnt += a[i]/l;
if (a[i]%l<0) cnt--; //就是这里细节的处理
((a[i]%=l)+=l)%=l;
}
std::sort(a+1, a+n+1);
((cnt%=n)+=n)%=n;
// for (int i=1; i<=n; i++) printf("%d\n",a[i]);
for (int i=cnt+1; i<=n; i++) printf("%d\n",a[i]);
for (int i=1; i<=cnt; i++) printf("%d\n",a[i]);
return 0;
} | a.cc:14:29: error: extended character is not valid in an identifier
14 | if (a[i]%l<0) cnt--; //就是这里细节的处理
| ^
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:14:29: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
14 | if (a[i]%l<0) cnt--; //就是这里细节的处理
| ^~~~~~~~~~~~~~~~
|
s066153414 | p03747 | C++ | #include<algorithm>
#include<cstdio>
#include<iostream>
#include<cmath>
#define N 200005
using namespace std;
int n,l,t;
long long Rank
int x[N],w[N],e[N];
int main()
{
scanf("%d%d%d",&n,&l,&t);
Rank=1;
for (int i=1;i<=n;i++)
{
scanf("%d%d",&x[i],&w[i]);
e[i]=x[i]+((w[i]==1)?1:-1)*t;
e[i]%=l;
e[i]=(e[i]+l)%l;
if (w[i]==1)
Rank+=(x[i]+t)/l; else
Rank-=(l-x[i]-1+t)/l;
}
sort(e+1,e+n+1);
for (int i=Rank;i<=n;i++)
printf("%d\n",e[i]);
for (int i=1;i<Rank;i++)
printf("%d\n",e[i]);
return 0;
} | a.cc:9:1: error: expected initializer before 'int'
9 | int x[N],w[N],e[N];
| ^~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'Rank' was not declared in this scope
13 | Rank=1;
| ^~~~
a.cc:16:31: error: 'x' was not declared in this scope
16 | scanf("%d%d",&x[i],&w[i]);
| ^
a.cc:16:37: error: 'w' was not declared in this scope
16 | scanf("%d%d",&x[i],&w[i]);
| ^
a.cc:17:17: error: 'e' was not declared in this scope
17 | e[i]=x[i]+((w[i]==1)?1:-1)*t;
| ^
a.cc:24:14: error: 'e' was not declared in this scope
24 | sort(e+1,e+n+1);
| ^
|
s191115282 | p03747 | C++ | #define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)
using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;
template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
std::cout << std::setprecision(15) << std::fixed;
i64 n;
i64 L, T;
std::cin >> n >> L >> T;
vec<i64> ans(n);
i64 cnt = 0;
for (i64 i=0; i<n; i++) {
i64 x, w;
std::cin >> x >> w;
i64 r = w==1 ? (x + T) % L : ((x - T) % L + L) % L;
i64 q = w==1 ? (x + T) / L : -((T - x + L - 1) / L);
ans.at(i) = r;
cnt += q;
}a#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)
using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;
template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
std::cout << std::setprecision(15) << std::fixed;
i64 n;
i64 L, T;
std::cin >> n >> L >> T;
vec<i64> ans(n);
i64 cnt = 0;
for (i64 i=0; i<n; i++) {
i64 x, w;
std::cin >> x >> w;
i64 y = x + (w==1 ? T : -T);
i64 r = (y % L + L) % L;
i64 q = (y - r) / L;
ans.at(i) = r;
cnt += q;
}
cnt = (cnt % n + n) % n;
std::sort(ALL(ans));
std::rotate(ans.begin(), ans.begin() + cnt, ans.end());
for (i64 x: ans) {
std::cout << x <<'\n';
}
}
cnt = (cnt % n + n) % n;
std::sort(ALL(ans));
std::rotate(ans.begin(), ans.begin() + cnt, ans.end());
for (i64 x: ans) {
std::cout << x <<'\n';
}
}
| a.cc:45:7: error: stray '#' in program
45 | }a#define ENABLE_DEBUG 1
| ^
a.cc: In function 'int main()':
a.cc:45:6: error: 'a' was not declared in this scope
45 | }a#define ENABLE_DEBUG 1
| ^
a.cc:57:1: error: a template declaration cannot appear at block scope
57 | template <class T, class U> using pair = std::pair<U, T>;
| ^~~~~~~~
a.cc:59:1: error: a template declaration cannot appear at block scope
59 | template <class... Args> using tuple = std::tuple<Args...>;
| ^~~~~~~~
a.cc:61:1: error: a template declaration cannot appear at block scope
61 | template <class T> using numr = std::numeric_limits<T>;
| ^~~~~~~~
|
s180032207 | p03747 | C++ | int main() {
std::cin.tie(0); std::ios::sync_with_stdio(false);
int N; double L, T; std::cin >> N >> L >> T;
std::vector<double> x(N), v(N), a(N);
T -= 1.0/16.0;
for(int i = 0; i < N; ++i) {
int X, W; std::cin >> X >> W;
x[i] = X;
if(W == 1) {
v[i] = 1.0;
a[i] = std::fmod(x[i] + T, L);
} else {
v[i] = -1.0;
a[i] = std::fmod(x[i] - T, L);
a[i] = std::fmod(a[i]+L, L);
}
}
double p0 = a[0];
std::sort(a.begin(), a.end());
int n0 = 0;
if(v[0] > 0) {
for(int i = 1; i < N; ++i) if(v[0]+v[i] == 0) {
if(T+T > x[i]-x[0]) {
double t = T+T-(x[i]-x[0]);
(n0 += 1+int(t/L)) %= N;
}
}
} else for(int i = 1; i < N; ++i) if(v[0]+v[i] == 0) {
if(T+T > L - (x[i]-x[0])) {
double t = T+T-(L-(x[i]-x[0]));
(n0 -= 1+int(t/L)) %= N;
(n0 += N) %= N;
}
}
int i0 = std::lower_bound(a.begin(), a.end(), p0) - a.begin();
(i0 += N-n0) %= N;
for(int i = 0; i < N; ++i) {
std::cout << int(a[(i0+i)%N]+1.0/8.0)%(int)L << "\n";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:2:8: error: 'cin' is not a member of 'std'
2 | std::cin.tie(0); std::ios::sync_with_stdio(false);
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | int main() {
a.cc:2:25: error: 'std::ios' has not been declared
2 | std::cin.tie(0); std::ios::sync_with_stdio(false);
| ^~~
a.cc:3:28: error: 'cin' is not a member of 'std'
3 | int N; double L, T; std::cin >> N >> L >> T;
| ^~~
a.cc:3:28: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:4:8: error: 'vector' is not a member of 'std'
4 | std::vector<double> x(N), v(N), a(N);
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | int main() {
a.cc:4:15: error: expected primary-expression before 'double'
4 | std::vector<double> x(N), v(N), a(N);
| ^~~~~~
a.cc:7:20: error: 'cin' is not a member of 'std'
7 | int X, W; std::cin >> X >> W;
| ^~~
a.cc:7:20: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:5: error: 'x' was not declared in this scope
8 | x[i] = X;
| ^
a.cc:10:7: error: 'v' was not declared in this scope
10 | v[i] = 1.0;
| ^
a.cc:11:7: error: 'a' was not declared in this scope
11 | a[i] = std::fmod(x[i] + T, L);
| ^
a.cc:11:19: error: 'fmod' is not a member of 'std'
11 | a[i] = std::fmod(x[i] + T, L);
| ^~~~
a.cc:13:7: error: 'v' was not declared in this scope
13 | v[i] = -1.0;
| ^
a.cc:14:7: error: 'a' was not declared in this scope
14 | a[i] = std::fmod(x[i] - T, L);
| ^
a.cc:14:19: error: 'fmod' is not a member of 'std'
14 | a[i] = std::fmod(x[i] - T, L);
| ^~~~
a.cc:15:19: error: 'fmod' is not a member of 'std'
15 | a[i] = std::fmod(a[i]+L, L);
| ^~~~
a.cc:18:15: error: 'a' was not declared in this scope
18 | double p0 = a[0];
| ^
a.cc:19:8: error: 'sort' is not a member of 'std'
19 | std::sort(a.begin(), a.end());
| ^~~~
a.cc:21:6: error: 'v' was not declared in this scope
21 | if(v[0] > 0) {
| ^
a.cc:23:16: error: 'x' was not declared in this scope
23 | if(T+T > x[i]-x[0]) {
| ^
a.cc:29:19: error: 'x' was not declared in this scope
29 | if(T+T > L - (x[i]-x[0])) {
| ^
a.cc:35:17: error: 'lower_bound' is not a member of 'std'
35 | int i0 = std::lower_bound(a.begin(), a.end(), p0) - a.begin();
| ^~~~~~~~~~~
a.cc:38:10: error: 'cout' is not a member of 'std'
38 | std::cout << int(a[(i0+i)%N]+1.0/8.0)%(int)L << "\n";
| ^~~~
a.cc:38:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s036349977 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int main () {
int N, L, T;
cin >> N >> L >> T;
vector<tuple<int, int, int>>an(N);
for (int i = 0; i < N; i ++) {
int x, w;
cin >> x >> w;
an[i] = make_tuple(x, w, i);
}
int num = 0;
for (int i = 1; i < N; i ++) {
if (get<1>an[i] == get<1>an[0]) continue;
int t = get<0>an[i] - get<0>an[0];
if (!(get<1>an[0] % 2)) {
t = L - t;
}
int ti = T * 2 - t;
if (ti < 0) continue;
ti /= L;
num += ti + 1;
num %= N;
}
vector<int>ans(N);
int kj = num;
if (get<1>an[0] == 2) kj = (N - num) % 2;
int tim = T % L;
ans[num] = (get<0>an[0] + tim) % L;
if (get<1>an[0] == 2) ans[num] = (L - tim + get<0>an[0]) % L;
vector<int>as(N);
for (int i = 0; i < N; i ++) {
as[i] = (get<0>an[i] + tim) % L;
if (get<1>an[i] == 2) as[i] = (L - tim + get<0>an[i]) % L;
}
sort(as.begin(), as.end());
int al = 0;
while (as[al] != ans[num]) al ++;
for (int i = 1; i < N; i ++) {
int j = i + al;
j %= N;
int k = i + num;
k %= N;
ans[k] = as[j];
}
for (int i = 0; i < N; i ++) {
cout << ans[i] << endl;
}
} | a.cc: In function 'int main()':
a.cc:14:15: error: expected ')' before 'an'
14 | if (get<1>an[i] == get<1>an[0]) continue;
| ~ ^~
| )
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:1:
/usr/include/c++/14/variant: In instantiation of 'struct std::variant_alternative<1, std::variant<> >':
/usr/include/c++/14/variant:106:11: required by substitution of 'template<long unsigned int _Np, class _Variant> using std::variant_alternative_t = typename std::variant_alternative::type [with long unsigned int _Np = 1; _Variant = std::variant<>]'
106 | using variant_alternative_t =
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/variant:1748:5: required from here
1748 | get(const variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/variant:100:25: error: static assertion failed
100 | static_assert(_Np < sizeof...(_Types));
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/variant:100:25: note: the comparison reduces to '(1 < 0)'
In file included from /usr/include/c++/14/bits/stl_pair.h:62,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/utility.h: In instantiation of 'struct std::_Nth_type<1>':
/usr/include/c++/14/variant:102:13: required from 'struct std::variant_alternative<1, std::variant<> >'
102 | using type = typename _Nth_type<_Np, _Types...>::type;
| ^~~~
/usr/include/c++/14/variant:106:11: required by substitution of 'template<long unsigned int _Np, class _Variant> using std::variant_alternative_t = typename std::variant_alternative::type [with long unsigned int _Np = 1; _Variant = std::variant<>]'
106 | using variant_alternative_t =
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/variant:1748:5: required from here
1748 | get(const variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/bits/utility.h:237:13: error: '__type_pack_element' index is out of range
237 | { using type = __type_pack_element<_Np, _Types...>; };
| ^~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/tuple: In instantiation of 'struct std::tuple_element<1, std::tuple<> >':
/usr/include/c++/14/bits/utility.h:84:11: required by substitution of 'template<long unsigned int __i, class _Tp> using std::__tuple_element_t = typename std::tuple_element::type [with long unsigned int __i = 1; _Tp = std::tuple<>]'
84 | using __tuple_element_t = typename tuple_element<__i, _Tp>::type;
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2466:5: required from here
2466 | get(const tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2422:25: error: static assertion failed: tuple index must be in range
2422 | static_assert(__i < sizeof...(_Types), "tuple index must be in range");
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2422:25: note: the comparison reduces to '(1 < 0)'
a.cc:14:35: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
14 | if (get<1>an[i] == get<1>an[0]) continue;
| ^
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:14:9: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
14 | if (get<1>an[i] == get<1>an[0]) continue;
| ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:14:9: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
14 | if (get<1>an[i] == get<1>an[0]) continue;
| ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:15:13: error: cannot resolve overloaded function 'get' based on conversion to type 'int'
15 | int t = get<0>an[i] - get<0>an[0];
| ^~~~~~
a.cc:16:17: error: expected ')' before 'an'
16 | if (!(get<1>an[0] % 2)) {
| ~ ^~
| )
a.cc:18:5: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
18 | }
| ^
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:18:5: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
18 | }
| ^
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:18:6: error: expected ')' before 'int'
18 | }
| ^
| )
19 | int ti = T * 2 - t;
| ~~~
a.cc:16:8: note: to match this '('
16 | if (!(get<1>an[0] % 2)) {
| ^
a.cc:20:9: error: 'ti' was not declared in this scope; did you mean 't'?
20 | if (ti < 0) continue;
| ^~
| t
a.cc:21:5: error: 'ti' was not declared in this scope; did you mean 't'?
21 | ti /= L;
| ^~
| t
a.cc:27:13: error: expected ')' before 'an'
27 | if (get<1>an[0] == 2) kj = (N - num) % 2;
| ~ ^~
| )
a.cc:27:23: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
27 | if (get<1>an[0] == 2) kj = (N - num) % 2;
| ^
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:27:7: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
27 | if (get<1>an[0] == 2) kj = (N - num) % 2;
| ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:27:7: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
27 | if (get<1>an[0] == 2) kj = (N - num) % 2;
| ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:29:21: error: expected ')' before 'an'
29 | ans[num] = (get<0>an[0] + tim) % L;
| ~ ^~
| )
a.cc:29:36: error: cannot resolve overloaded function 'get' based on conversion to type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
29 | ans[num] = (get<0>an[0] + tim) % L;
| ^
a.cc:30:13: error: expected ')' before 'an'
30 | if (get<1>an[0] == 2) ans[num] = (L - tim + get<0>an[0]) % L;
| ~ ^~
| )
a.cc:30:23: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
30 | if (get<1>an[0] == 2) ans[num] = (L - tim + get<0>an[0]) % L;
| ^
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:30:7: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
30 | if (get<1>an[0] == 2) ans[num] = (L - tim + get<0>an[0]) % L;
| ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
a.cc:30:7: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
30 | if (get<1>an[0] == 2) ans[num] = (L - tim + get<0>an[0]) % L;
| ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
/usr/include/c++/14/variant: In instantiation of 'struct std::variant_alternative<0, std::variant<> >':
/usr/include/c++/14/variant:106:11: required by substitution of 'template<long unsigned int _Np, class _Variant> using std::variant_alternative_t = typename std::variant_alternative::type [with long unsigned int _Np = 0; _Variant = std::variant<>]'
106 | using variant_alternative_t =
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/variant:1748:5: required f |
s438103021 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N, L, T;
cin >> N >> L >> T;
vector<int> x(N+1);
vector<int> w(N+1);
for(int i = 0; i < N; i++){
cin >> x[i] >> w[i];
}
x[N] = x[0];
w[N] = w[0];
for(int t = 1; t <= T; t++){
for(int i = 0; i < N; i++){
if((x[i] == x[i+1]-1 || x[i] == x[i+1]+L-1) && w[i] == 1 && w[i+1] == 2){//差が1、向かい合うとき
swap(w[i], w[i+1]);
i = i + 1;
}
else if((x[i] == x[i+1]) && w[i] == 1 && w[i+1] == 2){//差が0、向かい合うとき
x[i] = (x[i]-1)%L;
x[i+1] = (x[i]+1)%L;
swap(w[i], w[i+1]);
i = i + 1;
}
else{
if(w[i] == 1){
x[i] = (x[i]+1) % L;
}
else{
x[i] = (x[i]-1) % L;
}
}
}
}
cout << x[i]+1 << endl;
for(int i = 1; i < N; i++){//出力
cout << x[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:37:13: error: 'i' was not declared in this scope
37 | cout << x[i]+1 << endl;
| ^
|
s500636096 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int name(){
int N, L, T;
cin >> N >> L >> T;
vector<int> x(N+1);
vector<int> w(N+1);
for(int i = 0; i < N; i++){
cin >> x[i] >> w[i];
}
x[N] = x[0];
w[N] = w[0];
for(int t = 1; t <= T; t++){
for(int i = 0; i < N; i++){
if((x[i] == x[i+1]-1 || x[i] == x[i+1]+L-1) && w[i] == 1 && w[i+1] == 2){//差が1、向かい合うとき
swap(w[i], w[i+1]);
i = i + 1;
}
else if((x[i] == x[i+1]) && w[i] == 1 && w[i+1] == 2){//差が0、向かい合うとき
x[i] = (x[i]-1)%L;
x[i+1] = (x[i]+1)%L;
swap(w[i], w[i+1]);
i = i + 1;
}
else{
if(w[i] == 1){
x[i] = (x[i]+1) % L;
}
else{
x[i] = (x[i]-1) % L;
}
}
}
}
for(int i = 0; i < N; i++){//出力
cout << x[i] << endl;
}
}
| a.cc: In function 'int name()':
a.cc:40:1: warning: no return statement in function returning non-void [-Wreturn-type]
40 | }
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s292751252 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int name(){
int N, L, T;
cin >> N >> L >> T;
vector<int> x(N+1);
vector<int> w(N+1);
for(int i = 0; i < N; i++){
cin >> x[i] >> w[i];
}
x[N] = x[0];
w[N] = w[0];
for(int t = 1; t <= T; t++){
for(int i = 0; i < N; i++){
if((x[i] == x[i+1]-1 || x[i] == x[i+1]+L-1) && w[i] == 1 && w[i+1] == 2){//差が1、向かい合うとき
swap(w[i], w[i+1]);
i = i + 1;
}
else if((x[i] == x[i+1]) && w[i] == 1 && w[i+1] == 2){//差が0、向かい合うとき
x[i] = (x[i]-1)%L
x[i+1] = (x[i]+1)%L
swap(w[i], w[i+1]);
i = i + 1;
}
else{
if(w[i] == 1){
x[i] = (x[i]+1) % L;
}
else{
x[i] = (x[i]-1) % L;
}
}
}
}
for(int i = 0; i < N; i++){//出力
cin << x[i] << endl;
}
}
| a.cc: In function 'int name()':
a.cc:22:26: error: expected ';' before 'x'
22 | x[i] = (x[i]-1)%L
| ^
| ;
23 | x[i+1] = (x[i]+1)%L
| ~
a.cc:38:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
38 | cin << x[i] << endl;
a.cc:38:9: note: candidate: 'operator<<(int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int})' (built-in)
a.cc:38:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:38:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
38 | cin << x[i] << endl;
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits |
s868859248 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int name(){
int N, L, T;
cin >> N >> L >> T;
vector<int> x(N+1);
vector<int> w(N+1);
for(int i = 0, i < N; i++){
cin >> x[i] >> w[i];
}
x[N] = x[0];
w[N] = w[0];
for(int t = 1; t <= T; t++){
for(i = 0; i < N; i++){
if((x[i] == x[i+1]-1 || x[i] == x[i+1]+L-1) && w[i] == 1 && w[i+1] == 2){//差が1、向かい合うとき
swap(w[i], w[i+1]);
i = i + 1;
}
else if((x[i] == x[i+1]) && w[i] == 1 && w[i+1] == 2){//差が0、向かい合うとき
x[i] = (x[i]-1)%L
x[i+1] = (x[i]+1)%L
swap(w[i], w[i+1]);
i = i + 1;
}
else{
if(w[i] == 1){
x[i] = (x[i]+1) % L;
}
else{
x[i] = (x[i]-1) % L;
}
}
}
}
for(int i = 0; i < N; i++){//出力
cin << x[i] << endl;
}
}
| a.cc: In function 'int name()':
a.cc:9:19: error: expected ';' before '<' token
9 | for(int i = 0, i < N; i++){
| ^~
| ;
a.cc:9:20: error: expected primary-expression before '<' token
9 | for(int i = 0, i < N; i++){
| ^
a.cc:16:9: error: 'i' was not declared in this scope
16 | for(i = 0; i < N; i++){
| ^
a.cc:38:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
38 | cin << x[i] << endl;
a.cc:38:9: note: candidate: 'operator<<(int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int})' (built-in)
a.cc:38:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:38:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
38 | cin << x[i] << endl;
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:38:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
38 | cin << x[i] << endl;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template< |
s988536452 | p03747 | C++ | #include<bits/sydc++.h>
using namespace std;
int name(){
int N, L, T;
cin >> N >> L >> T;
vector<int> x(N+1);
vector<int> w(N+1);
for(int i = 0, i < N; i++){
cin >> x[i] >> w[i];
}
x[N] = x[0];
w[N] = w[0];
for(int t = 1; t <= T; t++){
for(i = 0; i < N; i++){
if((x[i] == x[i+1]-1 || x[i] == x[i+1]+L-1) && w[i] == 1 && w[i+1] == 2){//差が1、向かい合うとき
swap(w[i], w[i+1]);
i = i + 1;
}
else if((x[i] == x[i+1]) && w[i] == 1 && w[i+1] == 2){//差が0、向かい合うとき
x[i] = (x[i]-1)%L
x[i+1] = (x[i]+1)%L
swap(w[i], w[i+1]);
i = i + 1;
}
else{
if(w[i] == 1){
x[i] = (x[i]+1) % L;
}
else{
x[i] = (x[i]-1) % L;
}
}
}
}
for(int i = 0; i < N; i++){//出力
cin << x[i] << endl;
}
}
| a.cc:1:9: fatal error: bits/sydc++.h: No such file or directory
1 | #include<bits/sydc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s441220620 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,L,T;
cin>>N>>L>>T;
int x[N],w[N];
for(int i=0;i<N;i++)cin>>x[i]>>w[i];
int count=0;
int y[N];
for(int i=0;i<N;i++){
if(w[i]==1) {
y[i]=(x[i]+T)%L;
count+=(x[i]+T)/L;
}
else {
y[i]=((x[i]-T)%L+L)%L;
if(T > x[i]){
count -= (T-x[i])/L;
if((x[i]-T)%L<0) count--;
}
}
sort(y,y+N);
count=(count%N+N)%N;
for(int i=count;i<N;i++){
cout<<y[i]<<endl;
}
for(int i=0;i<count;i++){
cout<<y[i]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
37 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s472472865 | p03747 | C++ | #include<bits/stdc++.h>
#define rep(i,n) for(long long i=0;i<(n);i++)
#define ll long long
using namespace std;
int main(){
ll L,N,T;
vector<ll> X;
vector<int> W;
cin >> N >> L >> T;
rep(i,N) {
ll a,b;
cin >> a >> b;
X.push_back(a);W.push_back(b);
};
vector<ll> ans; ll count = 0;
rep(i,N){
ll d = (W[i] == 1) ? (X[i] + T) : (X[i] - T);
if(W[i] == 1){
count += d/L;
} else {
if(d < 0) count += -1 + d/L ;
}
d %= L;
if(d < 0) d = L + d;
ans.push_back(d);
}
count = (count % N + N)%N;
sort(ans.begin(),ans.end());
rep(i,N){
int p = (i + count)%N;
if(p < 0) p = n + p;
cout << ans[p] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:32:23: error: 'n' was not declared in this scope
32 | if(p < 0) p = n + p;
| ^
|
s094427342 | p03747 | C++ | #include <bits/stdc++.h>
int N, L, T;
float X[110000];
int W[110000];
int main () {
cin >> N >> L >> T;
for (int i = 1; i < N + 1; i++) cin >> X[i] >> W[i];
for (float t = 0.5; t <= T; t += 0.5) {
//t秒のときの位置へ移動
for (int i = 1; i < N + 1; i++) {
if (W[i] == 1) {
X[i] += 0.5;
} else {
X[i] -= 0.5;
}
//円の始点終点調整
if (X[i] == L) {
X[i] = 0;
} else if (X[i] < 0) {
X[i] = (float)L - 0.5;
}
}
//衝突判定
for (int i = 1; i < N; i++) {
if (X[i] == X[i + 1]) {
W[i] = 2;
W[i + 1] = 1;
}
}
if (X[1] == X[N]) {
W[1] = 1;
W[N] = 2;
}
}
//出力
for (int i = 1; i < N + 1; i++) {
cout << (int)X[i]
}
} | a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
8 | cin >> N >> L >> T;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:41:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
41 | cout << (int)X[i]
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s829417097 | p03747 | C++ | #include <iostream>
#include <string>
using namespace std;
int main() {
int n,len,t;
double x[n];
int w[n];
for (int i=0; i<n; i++) {
cin >> x[i];
cin >> w[i];
}
for (int i=0; i<t; i++) {
for (int j=0; j<n; j++) {
// get target ant
int f = j - 1;
int b = j + 1;
if (j == 0) { f = n; }
if (w[j] == 2) {
// clockwise
// change way.
if (w[f] == 1 && x[j] == x[f] + 1) {
w[j] = 1;
} else {
if (x[j] == 0) { x[j] = len - 1; }
else { x[j] -= 1; }
}
}
if (w[j] == 1) {
// anticlockwise
// change way.
if (w[b] == 2 && x[j] + 1 == x[b]) {
w[j] = 1;
} else {
if (x[j] == len) { x[j] = 0; }
else { x[j] += 1; }
}
}
}
for (int i=0; i<n; i++) {
cout << x[i] << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:47:2: error: expected '}' at end of input
47 | }
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s177856100 | p03747 | C++ | #include <iostream>
#include <string>
using namespace std;
int main() {
int n,len,t;
double x[n];
int w[n];
for (int i=0; i<n; i++) {
cin >> x[i];
cin >> w[i];
}
for (int i=0; i<t; i++) {
for (int j=0; j<n; j++) {
// get target ant
int f = j - 1;
int b = j + 1;
if (j == 0) { f = n }
if (w[j] == 2) {
// clockwise
// change way.
if (w[f] == 1 && x[j] == x[f] + 1) {
w[j] = 1;
} else {
if (x[j] == 0) { x[j] = len - 1; }
else { x[j] -= 1; }
}
}
if (w[j] == 1) {
// anticlockwise
// change way.
if (w[b] == 2 && x[j] + 1 == x[b]) {
w[j] = 1;
} else {
if (x[j] == len) { x[j] = 0; }
else { x[j] += 1; }
}
}
}
for (int i=0; i<n; i++) {
cout << x[i] << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:26: error: expected ';' before '}' token
19 | if (j == 0) { f = n }
| ^~
| ;
a.cc:47:2: error: expected '}' at end of input
47 | }
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s375001709 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long int N,L,T,S=0,x;
cin>>N>>L>>T;
vector<long long int>X(N),H(N),W(N);
for(long long int i=0;i<N;i++){
cin>>X.at(i)>>W.at(i);
H.at(i)=X.at(i);
}
for(long long int i=0;i<N;i++){
if(W.at(i)==1)X.at(i)=(X.at(i)+T)%L;
else X.at(i)=(X.at(i)-T+L)%L;
if(X.at(i)<0)X.at(i)+=L;
}
x=X.at(0);
sort(X.begin(),X.end());
for(long long int i=1;i<N;i++)if(W.at(i)!=W.at(0)){
if(W.at(0)==1)S+=(2*T-H.at(i)+H.at(0))/L+1;
else S-=(2*T+H.at(i)-H.at(0))/L;
}
long long int p=0,q=1;
while(X.at(p)!=x)p++;
while(q<N&&W.at(0)!=W.at(q))q++;
if(q<min(N,3)&&H.at(q)-H.at(0)!=X.at((p+q)%N)-X.at(p)&&X.at((p+1)%N)==x)p++;
p=(p-S)%N;if(p<0)p+=N;
for(long long int i=0;i<N;i++)cout<<X.at((p+i)%N)<<endl;
} | a.cc: In function 'int main()':
a.cc:25:11: error: no matching function for call to 'min(long long int&, int)'
25 | if(q<min(N,3)&&H.at(q)-H.at(0)!=X.at((p+q)%N)-X.at(p)&&X.at((p+1)%N)==x)p++;
| ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:25:11: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
25 | if(q<min(N,3)&&H.at(q)-H.at(0)!=X.at((p+q)%N)-X.at(p)&&X.at((p+1)%N)==x)p++;
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:25:11: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
25 | if(q<min(N,3)&&H.at(q)-H.at(0)!=X.at((p+q)%N)-X.at(p)&&X.at((p+1)%N)==x)p++;
| ~~~^~~~~
|
s145928270 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
/*座標0を軸としてアリの順番が何匹ずれたかだけを記憶し、順番は考慮せずにアリが存在する位置を計算。
アリが座標0を通るたびにアリの順番をずらす。
位置をソートしたのち、アリがずれた分だけ配列をずらして出力。*/
int main(void){
int N, L, T, x, w, gap;
cin >> N >> L >> T;
vector<int> X;
rep(i,N){
cin >> x >> w;
x += ((w+1) % 3 - 1) * T;
gap += x / L;
if(x < 0 && x % L != 0)gap--;
X.emplace_back(((x % L) + L) % L)
}
sort(X.begin(), X.end());
rep(i,N)cout << X[(((gap + i) % N) + N) % N] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:42: error: expected ';' before '}' token
17 | X.emplace_back(((x % L) + L) % L)
| ^
| ;
18 | }
| ~
|
s955391404 | p03747 | C++ | 1. #include<bits/stdc++.h>
2. #define N 100005
3. using namespace std;
4. int n,L,t,a[N],num;
5. int main()
6. {
7. int i,x,y;
8. cin>>n>>L>>t;
9. for(i=0;i<n;i++){
10. scanf("%d %d",&x,&y);
11. x+=(y==1 ? t : -t);
12. (num+=x/L)%=n,x%=L;
13. if(x<0) x+=L,num--;
14. a[i]=x;
15. }
16. sort(a,a+n);
17. for(i=0;i<n;i++)
18. printf("%d\n",a[(i+num+n)%n]);
19. return 0;
20. }
| a.cc:1:9: error: stray '#' in program
1 | 1. #include<bits/stdc++.h>
| ^
a.cc:2:9: error: stray '#' in program
2 | 2. #define N 100005
| ^
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1. #include<bits/stdc++.h>
| ^~
a.cc:4:1: error: expected unqualified-id before numeric constant
4 | 4. int n,L,t,a[N],num;
| ^~
a.cc:5:1: error: expected unqualified-id before numeric constant
5 | 5. int main()
| ^~
|
s978938534 | p03747 | C++ | #include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define N 200005
using namespace std;
typedef pair<int,int> Pair;
typedef long long ll;
const int mod = 1e9 + 7;
inline int add(int x, int y) { return (x += y) - (x >= mod ? mod : 0); }
inline void inc(int &x, int y) { (x += y) -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
int res = 1;
while (y) {
if (y & 1) res = mul(res, x);
x = mul(x, x), y >>= 1;
} return res;
}
template <class T> inline T input() {
T x; char ch; while (!isdigit(ch = getchar()));
for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
return x;
}
template <class T> inline void chkmin(T &x, T &y) { x = x < y ? x : y; }
template <class T> inline void chkmax(T &x, T &y) { x = x > y ? x : y; }
struct {
inline operator int () { return input<int>(); }
inline operator long long () { return input<long long>(); }
template <class T> inline void operator () (T &x) { x = *this; }
template<class T, class ...A> inline void operator () (T &x, A &...a)
{ x = *this; this -> operator ()(a...); }
} read;
int n, L, T, t, cnt, now;
int x[N], pos[N], d[N], ans[N];
int Next(int x) { return x == n ? 1 : x + 1; }
int Pre(int x) { return x > 1 ? x - 1 : n; }
signed main() {
read(n, L, T);
t = T / L, T %= L;
for (int i = 1; i <= n; ++i) read(x[i], d[i]), d[i] = d[i] == 2 ? -1 : 1;
for (int i = 1; i <= n; ++i) pos[i] = ((x[i] + T * d[i]) % L + L) % L;
for (int i = 2; i <= n; ++i) cnt += d[i] == -d[1];
now = 1ll * cnt * t % n + 1;
for (int i = 2; i <= n; ++i)
if (d[i] == -d[1]) {
if (d[1] == 1) {
if (x[i] - x[1] < T << 1) now = Next(now);
if (x[i] - x[1] < T * 2 - L) now = Next(now);
} else {
if (L - x[i] + x[1] <= T << 1) now = Pre(now);
if (L - x[i] + x[1] <= T * 2 - L) now = Pre(now);
}
}
ans[now] = pos[1];
sort(pos + 1, pos + n + 1);
int i = now % n + 1, j = (lower_bound(pos + 1, pos + n + 1, ans[now]) - pos) % n + 1;
for (; i ^ now; i = i % n + 1, j = j % n + 1) ans[i] = pos[j];
for (i = 1; i <= n; ++i) printf("%d\n", ans[i]);
return 0;
}
| a.cc:37:16: error: '<unnamed struct>::operator long long int()' cannot be overloaded with '<unnamed struct>::operator long long int()'
37 | inline operator long long () { return input<long long>(); }
| ^~~~~~~~
a.cc:36:16: note: previous declaration '<unnamed struct>::operator long long int()'
36 | inline operator int () { return input<int>(); }
| ^~~~~~~~
a.cc:41:3: error: '<unnamed struct> read' redeclared as different kind of entity
41 | } read;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /usr/include/c++/14/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
from a.cc:1:
/usr/include/unistd.h:371:16: note: previous declaration 'ssize_t read(int, void*, size_t)'
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
a.cc: In function 'int main()':
a.cc:50:17: error: invalid conversion from 'long long int' to 'void*' [-fpermissive]
50 | read(n, L, T);
| ^
| |
| long long int
/usr/include/unistd.h:371:38: note: initializing argument 2 of 'ssize_t read(int, void*, size_t)'
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ~~~~~~^~~~~
a.cc:52:52: error: invalid conversion from 'long long int' to 'void*' [-fpermissive]
52 | for (int i = 1; i <= n; ++i) read(x[i], d[i]), d[i] = d[i] == 2 ? -1 : 1;
| ~~~^
| |
| long long int
a.cc:52:42: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
52 | for (int i = 1; i <= n; ++i) read(x[i], d[i]), d[i] = d[i] == 2 ? -1 : 1;
| ~~~~^~~~~~~~~~~~
/usr/include/unistd.h:371:16: note: declared here
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
|
s115274795 | p03747 | C++ | #include<bits/stdc++.h>
const int maxn = 100035;
int a[maxn],n,l,t,x,cnt;
int main()
{
scanf("%d%d%d",&n,&l,&t);
for (int i=1; i<=n; i++)
{
scanf("%d%d",&a[i],&x);
a[i] += x==1?t:-t;
cnt += a[i]/l;
if (a[i]%l<0) cnt--; //就是这里细节的处理
((a[i]%=l)+=l)%=l;
}
std::sort(a+1, a+n+1);
((cnt%=n)+=n)%=n;
// for (int i=1; i<=n; i++) printf("%d\n",a[i]);
for (int i=cnt+1; i<=n; i++) printf("%d\n",a[i]);
for (int i=1; i<=cnt; i++) printf("%d\n",a[i]);
return 0;
} | a.cc:14:29: error: extended character is not valid in an identifier
14 | if (a[i]%l<0) cnt--; //就是这里细节的处理
| ^
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:14:29: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
14 | if (a[i]%l<0) cnt--; //就是这里细节的处理
| ^~~~~~~~~~~~~~~~
|
s719353416 | p03747 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll,ll> P;
typedef long double ld;
template <class T> div_minus (T a, T b) {
if (a % b < 0) return a / b - 1;
else return a / b;
}
template <class T> T mod_minus (T a, T b) {
if (a % b < 0) return a % b + b;
else return a % b;
}
int main(void)
{
ll n, l, t;
cin >> n >> l >> t;
vector<ll> x(n), w(n);
vector<P> res(n);
rep (i, n) {
cin >> x[i] >> w[i];
if (w[i] == 1) res[i].first = (x[i] + t) % l;
else res[i].first = mod_minus(x[i] - t, l);
res[i].second = i;
}
ll count = 0;
repp (i, 1, n) {
if (w[0] == 1) {
if (w[i] == 2) {
// cout << i << ": " << div_minus(2 * t - (x[i] - x[0]), l) + 1 << endl;
count += div_minus(2 * t - (x[i] - x[0]), l) + 1;
}
} else {
if (w[i] == 1) {
// cout << i << ": " << div_minus(2 * t - (l + x[0] - x[i]), l) + 1 << endl;
count -= div_minus(2 * t - (l + x[0] - x[i]), l) + 1;
}
}
}
sort(all(res));
ll k;
for (k = 0; k < n; k++) {
if (res[k].second == 0) break;
}
count = mod_minus(k - count, n);
rep(i, n) {
cout << res[(i + count) % n].first << endl;
}
return 0;
} | a.cc:36:20: error: ISO C++ forbids declaration of 'div_minus' with no type [-fpermissive]
36 | template <class T> div_minus (T a, T b) {
| ^~~~~~~~~
|
s428115829 | p03747 | C | #include<bits/stdc++.h>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
#define ll long long
const int maxn=100000+10;
int x[maxn],xx[maxn],w[maxn];
int i,j,k,l,r,s,t,n,m;
ll c;
inline int read()
{
int k=1;int x=0;
char ch=getchar();
while ((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
if(ch=='-')
k=-1,ch=getchar();
while(ch>='0'&&ch<='9')
x=x*10+ch-'0',ch=getchar();
return k*x;
}
int main()
{
n=read(),l=read(),t=read();
fo(i,1,n)
x[i]=read(),w[i]=read();
fo(i,1,n)
{
if (w[i]==2) w[i]=-1;
r=x[i]+w[i]*t;
if (r>0) (c+=r/l)%=n;
else if (r<0) (c+=(r+1)/l-1)%=n;
xx[i]=(r%l+l)%l;
}
sort(xx+1,xx+n+1);
c=(c+n)%n;
fo(i,c+1,n)
printf("%d\n",xx[i]);
fo(i,1,c) printf("%d\n",xx[i]);
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s067990681 | p03747 | Java | import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
int n = sc.nextInt();
int l = sc.nextInt();
long t = sc.nextInt();
int[] x = new int[n];
int[] w = new int[n];
for(int i=0;i<n;i++) {
x[i] = sc.nextInt();
w[i] = sc.nextInt();
}
int[] y = new int[n];
ArrayList<Integer> list = new ArrayList<>();
for(int i = 0;i<n;i++) {
if(w[i]==1) {
y[i] = location(l,x[i]+t);
}else {
y[i] = location(l,x[i]-t);
}
list.add(y[i]);
}
int firstIndex = y[0];
Collections.sort(list);
long counter =0;
if(w[0]==1) {
for(int i = 1;i<n;i++) {
if(w[i]==2) {
if(t*2-(x[i]-x[0])<0) {
}else {
counter+=(t*2-(x[i]-x[0]))/l+1;
}
}
}
counter = (counter+1)%n;
if(counter ==0)counter =n;
}else {
for(int i = n-1;i>0;i--) {
if(w[i]==1) {
if(t*2-(x[0]+l-x[i])<0) {
}else {
counter+=(t*2-(x[0]+l-x[i]))/l+1;
}
}
}
counter = (1-counter);
counter = counter%n;
if(counter<=0)counter+=n;
}
int offset = list.indexOf(firstIndex)-counter;
for(int i =1;i<n+1;i++) {
int listindex = offset+i;
if(listindex<0) {
listindex+=n;
}
if(listindex>=n) {
listindex-=n;
}
System.out.println(list.get(listindex));
}
/*
TreeMap<Integer,Integer> treeMap = new TreeMap<>();//sorted no duplication
treeMap.put(b[n], n);
*/
}
static int location(int length,long value) {
int loc = (int) (value%length);
if(loc<0)loc+=length;
return loc;
}
}
/*
class City{
int order;
int prefecture;
int year;
int number;
City(int order,int prefecture, int year){
this.order = order;
this.prefecture = prefecture;
this.year = year;
}
}
*/
| Main.java:72: error: incompatible types: possible lossy conversion from long to int
int offset = list.indexOf(firstIndex)-counter;
^
1 error
|
s525428667 | p03747 | Java | import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
int n = sc.nextInt();
int l = sc.nextInt();
long t = sc.nextInt();
int[] x = new int[n];
int[] w = new int[n];
for(int i=0;i<n;i++) {
x[i] = sc.nextInt();
w[i] = sc.nextInt();
}
int[] y = new int[n];
ArrayList<Integer> list = new ArrayList<>();
for(int i = 0;i<n;i++) {
if(w[i]==1) {
y[i] = location(l,x[i]+t);
}else {
y[i] = location(l,x[i]-t);
}
list.add(y[i]);
}
int firstIndex = y[0];
Collections.sort(list);
long counter =0;
if(w[0]==1) {
for(int i = 1;i<n;i++) {
if(w[i]==2) {
if(t*2-(x[i]-x[0])<0) {
}else {
counter+=(t*2-(x[i]-x[0]))/l+1;
}
}
}
counter = (counter+1)%n;
if(counter ==0)counter =n;
}else {
for(int i = n-1;i>0;i--) {
if(w[i]==1) {
if(t*2-(x[0]+l-x[i])<0) {
}else {
counter+=(t*2-(x[0]+l-x[i]))/l+1;
}
}
}
counter = (1-counter);
counter = counter%n;
if(counter<=0)counter+=n;
}
int offset = list.indexOf(firstIndex)-counter;
for(int i =1;i<n+1;i++) {
int listindex = offset+i;
if(listindex<0) {
listindex+=n;
}
if(listindex>=n) {
listindex-=n;
}
System.out.println(list.get(listindex));
}
/*
TreeMap<Integer,Integer> treeMap = new TreeMap<>();//sorted no duplication
treeMap.put(b[n], n);
*/
}
static int location(int length,long value) {
int loc = (int) (value%length);
if(loc<0)loc+=length;
return loc;
}
}
/*
class City{
int order;
int prefecture;
int year;
int number;
City(int order,int prefecture, int year){
this.order = order;
this.prefecture = prefecture;
this.year = year;
}
}
*/
| Main.java:72: error: incompatible types: possible lossy conversion from long to int
int offset = list.indexOf(firstIndex)-counter;
^
1 error
|
s289088435 | p03747 | C++ | kos amat
| a.cc:1:1: error: 'kos' does not name a type
1 | kos amat
| ^~~
|
s947178936 | p03747 | C++ | #include<cstdio>
#include<cstdlib>
#include<cassert>
#include<iostream>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;
inline int read()
{
int x=0; bool f=1; char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') f=0;
for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
if(f) return x;
return -x;
}
const int N = 1e5;
struct Element
{
int id,dir; llong x,endpos;
} a[N+3];
vector<llong> endpos;
int n; llong m,l;
llong divup(llong x,llong y) {return (x+y-1)/y;}
signed main()
{
scanf("%d%lld%lld",&n,&l,&m);
for(int i=0; i<n; i++)
{
scanf("%lld%d",&a[i].x,&a[i].dir); a[i].id = i;
if(a[i].dir==1) {a[i].endpos = (a[i].x+m)%l; endpos.push_back(a[i].endpos);}
else {a[i].endpos = ((a[i].x-m)%l+l)%l; endpos.push_back(a[i].endpos);}
}
sort(endpos.begin(),endpos.end());
if(a[0].dir==1)
{
int k; for(k=endpos.size()-1; k>=0; k--) {if(endpos[k]==a[0].endpos) break;}
llong tot = 0ll;
for(int i=1; i<n; i++)
{
if(a[i].dir==2)
{
llong dist = a[i].x-a[0].x;
llong cnt = (2ll*m-dist)/l+1;
tot += cnt;
}
}
// printf("tot=%lld k=%d\n",tot,k);
int sid = ((k-tot)%n+n)%n;
for(int j=sid; j<sid+n; j++)
{
printf("%lld\n",endpos[j%n]);
}
}
else if(a[0].dir==2)
{
int k; for(k=0; k<endpos.size(); k++) {if(endpos[k]==a[0].endpos) break;}
llong tot = 0ll;
for(int i=1; i<n; i++)
{
if(a[i].dir==1)
{
llong dist = a[0].x-a[i].x+l;
llong cnt = (2ll*m-dist)/l+1;
tot += cnt;
}
}
// printf("tot=%lld k=%d\n",tot,k);
int sid = ((k+tot)%n+n)%n;
for(int j=sid; j<sid+n; j++)
{
printf("%lld\n",endpos[j%n]);
}
}
return 0;
}
/*
5 20 17
3 1
4 1
5 1
18 2
19 1
*/
/*
5 20 5
5 2
6 1
7 1
18 2
19 1
*/ | a.cc:22:21: error: 'llong' does not name a type; did you mean 'ulong'?
22 | int id,dir; llong x,endpos;
| ^~~~~
| ulong
a.cc:24:8: error: 'llong' was not declared in this scope; did you mean 'ulong'?
24 | vector<llong> endpos;
| ^~~~~
| ulong
a.cc:24:13: error: template argument 1 is invalid
24 | vector<llong> endpos;
| ^
a.cc:24:13: error: template argument 2 is invalid
a.cc:25:8: error: 'llong' does not name a type; did you mean 'ulong'?
25 | int n; llong m,l;
| ^~~~~
| ulong
a.cc:27:1: error: 'llong' does not name a type; did you mean 'ulong'?
27 | llong divup(llong x,llong y) {return (x+y-1)/y;}
| ^~~~~
| ulong
a.cc: In function 'int main()':
a.cc:31:32: error: 'l' was not declared in this scope
31 | scanf("%d%lld%lld",&n,&l,&m);
| ^
a.cc:31:35: error: 'm' was not declared in this scope; did you mean 'tm'?
31 | scanf("%d%lld%lld",&n,&l,&m);
| ^
| tm
a.cc:34:38: error: 'struct Element' has no member named 'x'
34 | scanf("%lld%d",&a[i].x,&a[i].dir); a[i].id = i;
| ^
a.cc:35:39: error: 'struct Element' has no member named 'endpos'
35 | if(a[i].dir==1) {a[i].endpos = (a[i].x+m)%l; endpos.push_back(a[i].endpos);}
| ^~~~~~
a.cc:35:54: error: 'struct Element' has no member named 'x'
35 | if(a[i].dir==1) {a[i].endpos = (a[i].x+m)%l; endpos.push_back(a[i].endpos);}
| ^
a.cc:35:69: error: request for member 'push_back' in 'endpos', which is of non-class type 'int'
35 | if(a[i].dir==1) {a[i].endpos = (a[i].x+m)%l; endpos.push_back(a[i].endpos);}
| ^~~~~~~~~
a.cc:35:84: error: 'struct Element' has no member named 'endpos'
35 | if(a[i].dir==1) {a[i].endpos = (a[i].x+m)%l; endpos.push_back(a[i].endpos);}
| ^~~~~~
a.cc:36:28: error: 'struct Element' has no member named 'endpos'
36 | else {a[i].endpos = ((a[i].x-m)%l+l)%l; endpos.push_back(a[i].endpos);}
| ^~~~~~
a.cc:36:44: error: 'struct Element' has no member named 'x'
36 | else {a[i].endpos = ((a[i].x-m)%l+l)%l; endpos.push_back(a[i].endpos);}
| ^
a.cc:36:64: error: request for member 'push_back' in 'endpos', which is of non-class type 'int'
36 | else {a[i].endpos = ((a[i].x-m)%l+l)%l; endpos.push_back(a[i].endpos);}
| ^~~~~~~~~
a.cc:36:79: error: 'struct Element' has no member named 'endpos'
36 | else {a[i].endpos = ((a[i].x-m)%l+l)%l; endpos.push_back(a[i].endpos);}
| ^~~~~~
a.cc:38:21: error: request for member 'begin' in 'endpos', which is of non-class type 'int'
38 | sort(endpos.begin(),endpos.end());
| ^~~~~
a.cc:38:36: error: request for member 'end' in 'endpos', which is of non-class type 'int'
38 | sort(endpos.begin(),endpos.end());
| ^~~
a.cc:41:37: error: request for member 'size' in 'endpos', which is of non-class type 'int'
41 | int k; for(k=endpos.size()-1; k>=0; k--) {if(endpos[k]==a[0].endpos) break;}
| ^~~~
a.cc:41:68: error: invalid types 'int[long long int]' for array subscript
41 | int k; for(k=endpos.size()-1; k>=0; k--) {if(endpos[k]==a[0].endpos) break;}
| ^
a.cc:41:78: error: 'struct Element' has no member named 'endpos'
41 | int k; for(k=endpos.size()-1; k>=0; k--) {if(endpos[k]==a[0].endpos) break;}
| ^~~~~~
a.cc:42:17: error: 'llong' was not declared in this scope; did you mean 'ulong'?
42 | llong tot = 0ll;
| ^~~~~
| ulong
a.cc:47:38: error: expected ';' before 'dist'
47 | llong dist = a[i].x-a[0].x;
| ^~~~~
| ;
a.cc:48:38: error: expected ';' before 'cnt'
48 | llong cnt = (2ll*m-dist)/l+1;
| ^~~~
| ;
a.cc:49:33: error: 'tot' was not declared in this scope
49 | tot += cnt;
| ^~~
a.cc:49:40: error: 'cnt' was not declared in this scope; did you mean 'int'?
49 | tot += cnt;
| ^~~
| int
a.cc:53:31: error: 'tot' was not declared in this scope
53 | int sid = ((k-tot)%n+n)%n;
| ^~~
a.cc:56:47: error: invalid types 'int[long long int]' for array subscript
56 | printf("%lld\n",endpos[j%n]);
| ^
a.cc:61:42: error: request for member 'size' in 'endpos', which is of non-class type 'int'
61 | int k; for(k=0; k<endpos.size(); k++) {if(endpos[k]==a[0].endpos) break;}
| ^~~~
a.cc:61:65: error: invalid types 'int[long long int]' for array subscript
61 | int k; for(k=0; k<endpos.size(); k++) {if(endpos[k]==a[0].endpos) break;}
| ^
a.cc:61:75: error: 'struct Element' has no member named 'endpos'
61 | int k; for(k=0; k<endpos.size(); k++) {if(endpos[k]==a[0].endpos) break;}
| ^~~~~~
a.cc:62:17: error: 'llong' was not declared in this scope; did you mean 'ulong'?
62 | llong tot = 0ll;
| ^~~~~
| ulong
a.cc:67:38: error: expected ';' before 'dist'
67 | llong dist = a[0].x-a[i].x+l;
| ^~~~~
| ;
a.cc:68:38: error: expected ';' before 'cnt'
68 | llong cnt = (2ll*m-dist)/l+1;
| ^~~~
| ;
a.cc:69:33: error: 'tot' was not declared in this scope
69 | tot += cnt;
| ^~~
a.cc:69:40: error: 'cnt' was not declared in this scope; did you mean 'int'?
69 | tot += cnt;
| ^~~
| int
a.cc:73:31: error: 'tot' was not declared in this scope
73 | int sid = ((k+tot)%n+n)%n;
| ^~~
a.cc:76:47: error: invalid types 'int[long long int]' for array subscript
76 | printf("%lld\n",endpos[j%n]);
| ^
|
s348212449 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int x[100010],w[100010];
int ans[100010];
int n,L,r,t;
long long fldl;
int main()
{
scanf("%d%d%d",&n,&L,&t);
for(int i = 1;i <= n;i++)
{
scanf("%d%d",&x[i],&w[i]);
if(w[i] == 2)w[i] = -1;
}
for(int i = 1;i <= n;i++)
{
len = x[i] + w[i] * t;
if (len > 0) (fldl += len / L) %= n;
else if (len < 0) (fldl += (len + 1) / L - 1) %= n;
ans[i] = (len % L + L) % L;
}
sort(ans + 1 ,ans + n + 1);
fldl = (fldl + n) % n;
for(int i = fldl + 1;i <= n;i++)printf("%d\n",ans[i]);
for(int i = 1;i <= fldl;i++) printf("%d\n",ans[i]);
return 0;
} | a.cc: In function 'int main()':
a.cc:17:9: error: 'len' was not declared in this scope
17 | len = x[i] + w[i] * t;
| ^~~
|
s580745275 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll N, L, T;
cin >> N >> L >> T;
ll x[N], w[N];
for(int i = 0; i < N; i++){
cin >> x[i] >> w[i];
}
ll xx[N], ww[N];
for(int i = 0; i < N; i++){
xx[i] = x[i];
ww[i] = w[i];
}
for(int i = 0; i < N; i++){
if(w[i] == 1){
xx[i]+=T;
xx[i] = xx[i]%L;
}
else{
xx[i]-=T;
xx[i] = xx[i]%L;
}
}
for(int i = 0; i < N; i++){
if(w[i] == 1){
x[i] += T;
}
else{
x[i] -= T;
}
}
ll count = 0;
if(w[0] == 1){
for(int i = 0; i < N; i++){
x[i] -= x[0];
if(x[i] < 0){
x[i] += L;
}
}
for(int i = 0; i < N; i++){
if(w[i] == 2){
if(x[i] <= 2*T%L){
count++;
}
}
}
}
else{
for(int i = 0; i < N; i++){
x[i] = L-x[i];
x[i] -= x[0];
if(x[i] < 0){
x[i] += L;
}
}
for(int i = 0; i < N; i++){
if(w[i] == 1){
if(x[i] <= 2*T%L){
count++;
}
}
}
}
for(int i = 0; i < N; i++){
cout << xx[(i+count)%N)] << endl;
}
} | a.cc: In function 'int main()':
a.cc:68:27: error: expected ']' before ')' token
68 | cout << xx[(i+count)%N)] << endl;
| ^
| ]
a.cc:68:27: error: expected ';' before ')' token
68 | cout << xx[(i+count)%N)] << endl;
| ^
| ;
|
s148048930 | p03747 | C++ | #include <bits/stdc++.h>
int ri() {
int n;
scanf("%d", &n);
return n;
}
std::pair<bool, int> x0_pos(int64_t n, int64_t l, int64_t t, int64_t *x, int64_t *w) { // true if it's forwarding
t *= 2;
// assume w[0] = true
// first collision of x[0] ahead
int first_col;
int first_col_dist = 1000000001;
for (int i = 1; i < n; i++) {
if (w[i]) continue;
int dist = (x[i] - x[0] + l) % l;
if (dist < first_col_dist) first_col_dist = dist, first_col = i;
}
std::cerr << "dist:" << first_col_dist << " i:" << first_col << std::endl;
if (t <= first_col_dist) return {true, x[0]};
t -= first_col_dist;
std::vector<int> inv;
std::vector<int> ahead;
for (int i = 0; i < n; i++) if (!w[i]) inv.push_back(x[i]); else ahead.push_back(x[i]);
std::sort(inv.begin(), inv.end()); //******************//
std::sort(ahead.begin(), ahead.end()); // *************** //
std::vector<int64_t> interval_ahead;
std::vector<int64_t> interval_inv;
if (ahead.size() > 1) {
for (int i = ahead.size() - 1; i >= 0; i--) {
int64_t x2 = ahead[(i + 1) % ahead.size()];
int64_t x1 = ahead[i];
int64_t dist = (x2 - x1 + l) % l;
interval_ahead.push_back(dist);
}
assert(std::accumulate(interval_ahead.begin(), interval_ahead.end(), 0LL) == l);
} else interval_ahead.push_back(l);
if (inv.size() > 1) {
int first_col_comp = -1;
for (int i = 0; i < (int) inv.size(); i++) if (inv[i] == x[first_col]) first_col_comp = i;
assert(first_col_comp != -=1);
for (int i = 0; i < (int) inv.size(); i++) {
// first_col, first_col + 1
int64_t x2 = inv[(i + first_col_comp + 1) % inv.size()];
int64_t x1 = inv[(i + first_col_comp) % inv.size()];
int64_t dist = (x2 - x1 + l) % l;
interval_inv.push_back(dist);
}
assert(std::accumulate(interval_inv.begin(), interval_inv.end(), 0LL) == l);
} else interval_inv.push_back(l);
for (auto i : interval_inv) std::cerr << i << " ";
std::cerr << std::endl;
for (auto i : interval_ahead) std::cerr << i << " ";
std::cerr << std::endl;
int64_t ll = -1;
int64_t rr = 1000000001;
while (rr - ll > 1) {
int64_t m = ll + (rr - ll) / 2;
// m times
int64_t r0 = (int64_t) m / interval_ahead.size() * l;
for (int i = 0; i < m % interval_ahead.size(); i++) r0 += interval_ahead[i];
int64_t r1 = (int64_t) m / interval_inv.size() * l;
for (int i = 0; i < m % interval_inv.size(); i++) r1 += interval_inv[i];
if (r0 + r1 > t) rr = m;
else ll = m;
}
std::cerr << "ll:" << ll << std::endl;
int64_t r0 = ll / interval_ahead.size() * l;
for (int i = 0; i < ll % interval_ahead.size(); i++) r0 += interval_ahead[i];
int64_t r1 = ll / interval_inv.size() * l;
for (int i = 0; i < ll % interval_inv.size(); i++) r1 += interval_inv[i];
int64_t res = 0;
res -= r0;
t -= r0 + r1;
// l ~ r
std::cerr << "t-tt:" << t - (r0 + r1) << " int_ahead:" << interval_ahead[ll % interval_ahead.size()] << std::endl;
res -= std::min<int64_t>(t, interval_ahead[ll % interval_ahead.size()]);
bool dir;
if (!t) dir = true;
else if (t == interval_ahead[ll % interval_ahead.size()]) dir = false;
else dir = true; // nothing
return {dir, (res % l + x[0] + l) % l};
}
int main() {
int n = ri(), l = ri(), t = ri();
int64_t x[n], w[n];
for (int i = 0; i < n; i++) x[i] = ri(), w[i] = !(ri() - 1); // 1 => +
bool same = true;
for (int i = 0; i + 1 < n; i++) if (w[i] != w[i + 1]) same = false;
if (same) {
for (int i = 0; i < n; i++) {
std::cout << ((x[i] + t * (w[i] ? 1 : -1)) % l + l) % l << std::endl;
}
return 0;
}
bool inversed = false;
if (!w[0]) {
for (int i = 0; i < n; i++) w[i] = !w[i], x[i] = (l - x[i]) % l;
inversed = true;
}
auto res = x0_pos(n, l, t, x, w);
int64_t pos = res.second;
bool dir = res.first;
std::cerr << pos << ":" << dir << std::endl;
pos += t;
pos %= l;
if (inversed) pos = (l - pos) % l, dir = !dir;
std::cerr << pos << std::endl;
std::set<std::pair<int64_t, bool> > st;
for (int i = 0; i < n; i++) {
if (inversed) st.insert({((t * (!w[i] ? 1 : -1) - x[i]) % l + l) % l, !w[i]});
else st.insert({((x[i] + t * (w[i] ? 1 : -1)) % l + l) % l, w[i]});
}
assert(st.size() == n);
for (auto i : st) std::cerr << "pos:" << i.first << " dir:" << i.second << std::endl;
auto itr = st.lower_bound({pos, false});
assert(itr != st.end() && itr->first == pos);
if (std::next(itr) != st.end() && std::next(itr)->first == itr->first && itr->second != dir) {
itr++;
exit(0);
assert(itr->second == dir);
}
for (auto i = itr; i != st.end(); i++) std::cout << i->first << " ";
for (auto i = st.begin(); i != itr; i++) std::cout << i->first << " ";
std::cout << std::endl;
return 0;
}
| In file included from /usr/include/c++/14/cassert:44,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
from a.cc:1:
a.cc: In function 'std::pair<bool, int> x0_pos(int64_t, int64_t, int64_t, int64_t*, int64_t*)':
a.cc:42:42: error: expected primary-expression before '-=' token
42 | assert(first_col_comp != -=1);
| ^~
|
s643687472 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int counting=0;
int N,L,T;
cin >> N >> L >> T;
int x[N];
int vec[2];
for(int i=0; i<N; i++){
cin >> x[i] >> vec[i];
}
for (i=0; i<N; i++){
if(vec[i] == 1){
x[i] += T;
}else if(vec[i] == 2){
k[i] -= T;
}
}
for(i=0; i<N; i++){
if(x[i]<0){
counting++;
x[i]+=L
}else if(x[i]>L){
counting++;
x[i]-=L;
}
}
sort(x.begin(),x.end());
for(i=0; i<N; i++){
if(i+counting > N){
int k;
k=i+counting-N;
x[k] = x[i];
}else{
x[i+counting] = x[i];
}
}
for(i=0; i<N; i++){
cout << x[i] << endl;
}
} | a.cc: In function 'int main()':
a.cc:15:8: error: 'i' was not declared in this scope
15 | for (i=0; i<N; i++){
| ^
a.cc:19:7: error: 'k' was not declared in this scope
19 | k[i] -= T;
| ^
a.cc:23:7: error: 'i' was not declared in this scope
23 | for(i=0; i<N; i++){
| ^
a.cc:33:10: error: request for member 'begin' in 'x', which is of non-class type 'int [N]'
33 | sort(x.begin(),x.end());
| ^~~~~
a.cc:33:20: error: request for member 'end' in 'x', which is of non-class type 'int [N]'
33 | sort(x.begin(),x.end());
| ^~~
a.cc:35:7: error: 'i' was not declared in this scope
35 | for(i=0; i<N; i++){
| ^
a.cc:45:7: error: 'i' was not declared in this scope
45 | for(i=0; i<N; i++){
| ^
|
s460756011 | p03747 | C++ | #include<bits/stdc++>
using namespace std;
int main(){
int N,L,T,k;
double X[1000000000];
int W[1000000000];
cin >> N >> L >> T;
for(int i=0; i<N; i++){
cin >> X[i] >> W[i];
}
int TIME=2*T;
int newT;
for(newT=0; newT<TIME; newT++){
//座標操作
for(i=0; i<N; i++){
if(W[i] == 1){
X[i] += 0.5;
}else if(W[i] == 2){
X[i] -= 0.5;
}
X[i]=X[i]%(double)L;
//座標被ったときに方向転換させる
for(int k=0; k<=i; k++){
if(X[i] == X[k]){
if(W[i] == 1){
W[i] = 2;
}else if(W[i] == 2){
W[i] = 1;
}
}
}
}
}
for(k=0; k<N; k++){
cout << X[k] << endl;
}
}
| a.cc:1:9: fatal error: bits/stdc++: No such file or directory
1 | #include<bits/stdc++>
| ^~~~~~~~~~~~~
compilation terminated.
|
s823443697 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
ll L;
ll lmod(ll A) {
if (A < 0) {
A = 0 - A;
A %= L;
A = L - A;
}
else A %= L;
return A;
}
int main() {
ll N, T, X, W, X1, W1;
cin >> N >> L >> T;
vector<ll> Lant;
vector<ll> Rant;
vector<ll> last(N);
for (int i = 0;i < N;i++) {
cin >> X >> W;
if (i == 0) X1 = X, W1 = W;
if (W == 1) {
Rant.push_back(lmod(X1 - X));
last[i] = lmod(X + T);
}
else {
Lant.push_back(X - X1);
last[i] = lmod(X - T);
}
}
ll Ras = Rant.size();
ll Las = Lant.size();
sort(all(last));
reverse(all(Rant));
ll ri = 0, le = 0, r_it = 0, l_it = 0, fmet;
for (ll tim = 0; tim <= T;) {
if (W == 1) {
if (tim == 0 && Rant[r_it] == 0) {
Rant[r_it] += L;
r_it++;
if (r_it == Ras) r_it = 0;
continue;
}
fmet = Lant[l_it] - ri;
if (tim + (fmet + 1) / 2 > T) {
X1 += T - tim;
break;
}
X1 += fmet / 2; //ぶつかるまでの距離/2=時間
tim += (fmet + 1) / 2;
//途中でぶつかったら位置は切り捨てればよい Lantの要素との距離の差は距離分短くなるだけ
ri = Lant[l_it];
Lant[l_it] += L;
l_it++;
if (l_it == Las)
l_it = 0;
if (fmet % 2)
le++;
W = 2;
}
else {
if (tim == 0 && Lant[l_it] == 0) {
Lant[l_it] += L;
l_it++;
if (l_it == Las) l_it = 0;
continue;
}
fmet = Rant[r_it] - le;
if (tim + (fmet + 1) / 2 > T) {
X1 = lmod(X1 - (T - tim));
break;
}
X1 = lmod(X1 - fmet / 2);
tim += (fmet + 1) / 2;
le = Rant[r_it];
Rant[r_it] += L;
r_it++;
if (r_it == Ras)
r_it = 0;
if (fmet % 2)
ri++;
W = 1;
}
}
auto it = lower(all(last), X1);
for (int i = 0;i < N;i++) {
cout << *it << endl;
it++;
if (it == last.end())
it = last.begin();
}
} | a.cc: In function 'int main()':
a.cc:92:19: error: 'lower' was not declared in this scope; did you mean 'tolower'?
92 | auto it = lower(all(last), X1);
| ^~~~~
| tolower
|
s031115188 | p03747 | C++ | #include <iostream>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll l, t;
ll round(ll a, ll b){
return t * a / (l * (a + b));
}
int main()
{
ll n;
cin >> n >> l >> t;
ll x[100002];
int w[100002];
ll ans[100002];
P left[100002], right[100002];
ll le = 0, ri = 0;
for(ll i = 0; i < n; i++){
cin >> x[i] >> w[i];
if(w[i] == 1){
ans[i] = (x[i] + t) % l;
right[ri] = P(x[i], i);
ri++;
}
else{
ans[i] = (x[i] + l * t - t) % l;
left[le] = P(x[i], i);
le++;
}
}
ll ant;
ll rl;
t *= 2;
if(w[0] == 1){
if(le == 0){
ant = 0;
rl = 1;
}
else{
ll nowt = left[0].first - right[0].first + round(le, ri) * l + round(le, ri) * ri / le;
ll nowl = 0;
for(ll i = 0; i < round(le, ri) * ri % le; i++){
nowt += (left[(nowl + 1) % le].first + l - left[nowl].first - 1) % l + 1;
nowl = (nowl + 1) % le;
}
ll nowr = 0;
bool ifr = true;
while(t > nowt){
if(ifr){
nowt += (right[nowr].first + l - right[(nowr + ri - 1) % ri].first - 1) % l + 1;
nowr = (nowr + ri - 1) % ri;
ifr = false;
}
else{
nowt += (left[(nowl + 1) % le].first + l - left[nowl].first - 1) % l + 1;
nowl = (nowl + 1) % le;
ifr = true;
}
}
if(!ifr){
ant = left[nowl % le].second;
rl = 0;
}
else{
ant = right[nowr % ri].second;
rl = 1;
}
}
}
if(w[0] == 2){
if(ri == 0){
ant = 0;
rl = 0;
}
else{
ll nowt = left[0].first + l - right[ri - 1].first + round(ri, le) * l + round(ri, le) * le / ri;
ll nowr = (ri - 1) % ri;
for(ll i = 0; i < round(ri, le) * le % ri; i++){
nowt += (right[nowr].first + l - right[(nowr + ri - 1) % ri].first - 1) % l + 1;
nowr = (nowr + ri - 1) % ri;
}
ll nowl = 0;
bool ifr = false;
while(t > nowt){
if(ifr){
nowt += (right[nowr].first + l - right[(nowr + ri - 1) % ri].first - 1) % l + 1;
nowr = (nowr + ri - 1) % ri;
ifr = false;
}
else{
nowt += (left[(nowl + 1) % le].first + l - left[nowl].first - 1) % l + 1;
nowl = (nowl + 1) % le;
ifr = true;
}
}
if(!ifr){
ant = left[nowl % le].second;
rl = 0;
}
else{
ant = right[nowr % ri].second;
rl = 1;
}
}
}
ll pant = ans[ant];
sort(ans, ans + n);
ll want = lower_bound(ans, ans + n, pant) - ans;
if(ans[want] == ans[(want + 1) % n]){
if(rl == 0) want++;
}
for(ll i = 0; i < n; i++){
cout << ans[(want + i) % n] << endl;
}
} | a.cc: In function 'int main()':
a.cc:111:5: error: 'sort' was not declared in this scope; did you mean 'short'?
111 | sort(ans, ans + n);
| ^~~~
| short
|
s015749725 | p03747 | C++ | using namespace std;
int N, L, T;
//a 時計回り
//b 逆時計回り
int main() {
cin >> N >> L >> T;
vector<int> a(N), b(N);
int ac = 0;
int bc = 0;
int ai0 = 0;
int av0 = 0;
int ab0 = 0;
for (int i = 0; i < N; i ++){
int ci, wi;
cin >> ci >> wi;
if (wi == 1) {
if (ac == 0){
ai0 = i;
av0 = ci;
ab0 = bc;
}
a[ac] = ci;
ac++;
}else{
b[bc] = ci;
bc++;
}
}
int dt = T % L;
//例外処理
if (bc == 0) {
for(int i = 0; i < N; i++){
int p = (a.at(i) + dt) % L;
cout << p << endl;
}
return 0;
}
if (ac == 0) {
for(int i = 0; i < N; i++){
int p = (L + b.at(i) - dt) % L;
cout << p << endl;
}
return 0;
}
// (T % L)秒で何個の反時計周り出会うかの計算
int count = ai0 + (T / L) * bc * 2;
int dt2 = dt * 2 ;
if (dt2 >= L){
count += bc;
dt2 -= L;
}
int pb;
if ((av0 + dt2) > L){
auto iter = lower_bound(b.begin(), b.begin() + bc, av0 + dt2 - L);
pb = distance(b.begin(), iter);
count += bc + pb - ab0;
}
else{
auto iter = lower_bound(b.begin(), b.begin() + bc, av0 + dt2);
pb = distance(b.begin(), iter);
count += pb - ab0;
}
pb = pb % bc;
int av = (a.at(0) + dt) % L;
int bv = (L + b.at(pb) - dt) % L;
int pa = 0;
int base = av;
if (bv < base)
bv += L;
int acount = 0;
int bcount = 0;
count = count % N;
bool flag = count == 0;
queue<int> que;
while(acount < ac && bcount < bc){
if (av <= bv){
if(flag)
cout << av % L << endl;
else
que.push(av % L);
pa++;
if (pa == ac){
pa = 0;
}
av = (a.at(pa) + dt) % L;
if (av < base)
av += L;
acount++;
}
else{
if(flag)
cout << bv % L << endl;
else
que.push(bv % L);
pb++;
if (pb == bc){
pb = 0;
}
bv = (L + b.at(pb) - dt) % L;
if (bv < base)
bv += L;
bcount++;
}
count++;
if (count == N)
flag = true;
}
av %= L;
for(int i = acount; i < ac; i++){
if(flag)
cout << av % L << endl;
else
que.push(av);
pa++;
if (pa == ac){
pa = 0;
}
av = (a.at(pa) + dt) % L;
count++;
if (count == N)
flag = true;
}
bv %= L;
for(int i = bcount; i < bc; i++){
if (flag)
cout << bv << endl;
else
que.push(bv);
pb++;
if (pb == bc){
pb = 0;
}
bv = (L + b.at(pb) - dt) % L;
count++;
if (count == N)
flag = true;
}
while(!que.empty()) {
cout << que.front() << endl;
que.pop();
}
} | a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
7 | cin >> N >> L >> T;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:8:5: error: 'vector' was not declared in this scope
8 | vector<int> a(N), b(N);
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | using namespace std;
a.cc:8:12: error: expected primary-expression before 'int'
8 | vector<int> a(N), b(N);
| ^~~
a.cc:24:13: error: 'a' was not declared in this scope
24 | a[ac] = ci;
| ^
a.cc:27:13: error: 'b' was not declared in this scope
27 | b[bc] = ci;
| ^
a.cc:36:22: error: 'a' was not declared in this scope
36 | int p = (a.at(i) + dt) % L;
| ^
a.cc:37:13: error: 'cout' was not declared in this scope
37 | cout << p << endl;
| ^~~~
a.cc:37:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:26: error: 'endl' was not declared in this scope
37 | cout << p << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
a.cc:43:26: error: 'b' was not declared in this scope
43 | int p = (L + b.at(i) - dt) % L;
| ^
a.cc:44:13: error: 'cout' was not declared in this scope
44 | cout << p << endl;
| ^~~~
a.cc:44:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:44:26: error: 'endl' was not declared in this scope
44 | cout << p << endl;
| ^~~~
a.cc:44:26: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:58:33: error: 'b' was not declared in this scope; did you mean 'pb'?
58 | auto iter = lower_bound(b.begin(), b.begin() + bc, av0 + dt2 - L);
| ^
| pb
a.cc:58:21: error: 'lower_bound' was not declared in this scope
58 | auto iter = lower_bound(b.begin(), b.begin() + bc, av0 + dt2 - L);
| ^~~~~~~~~~~
a.cc:59:14: error: 'distance' was not declared in this scope
59 | pb = distance(b.begin(), iter);
| ^~~~~~~~
a.cc:1:1: note: 'std::distance' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
+++ |+#include <iterator>
1 | using namespace std;
a.cc:63:33: error: 'b' was not declared in this scope; did you mean 'pb'?
63 | auto iter = lower_bound(b.begin(), b.begin() + bc, av0 + dt2);
| ^
| pb
a.cc:63:21: error: 'lower_bound' was not declared in this scope
63 | auto iter = lower_bound(b.begin(), b.begin() + bc, av0 + dt2);
| ^~~~~~~~~~~
a.cc:64:14: error: 'distance' was not declared in this scope
64 | pb = distance(b.begin(), iter);
| ^~~~~~~~
a.cc:64:14: note: 'std::distance' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
a.cc:69:15: error: 'a' was not declared in this scope; did you mean 'av'?
69 | int av = (a.at(0) + dt) % L;
| ^
| av
a.cc:70:19: error: 'b' was not declared in this scope; did you mean 'bv'?
70 | int bv = (L + b.at(pb) - dt) % L;
| ^
| bv
a.cc:79:5: error: 'queue' was not declared in this scope
79 | queue<int> que;
| ^~~~~
a.cc:1:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
+++ |+#include <queue>
1 | using namespace std;
a.cc:79:11: error: expected primary-expression before 'int'
79 | queue<int> que;
| ^~~
a.cc:83:17: error: 'cout' was not declared in this scope
83 | cout << av % L << endl;
| ^~~~
a.cc:83:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:83:35: error: 'endl' was not declared in this scope
83 | cout << av % L << endl;
| ^~~~
a.cc:83:35: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:85:17: error: 'que' was not declared in this scope
85 | que.push(av % L);
| ^~~
a.cc:97:17: error: 'cout' was not declared in this scope
97 | cout << bv % L << endl;
| ^~~~
a.cc:97:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:97:35: error: 'endl' was not declared in this scope
97 | cout << bv % L << endl;
| ^~~~
a.cc:97:35: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:99:17: error: 'que' was not declared in this scope
99 | que.push(bv % L);
| ^~~
a.cc:116:13: error: 'cout' was not declared in this scope
116 | cout << av % L << endl;
| ^~~~
a.cc:116:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:116:31: error: 'endl' was not declared in this scope
116 | cout << av % L << endl;
| ^~~~
a.cc:116:31: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:118:13: error: 'que' was not declared in this scope
118 | que.push(av);
| ^~~
a.cc:131:13: error: 'cout' was not declared in this scope
131 | cout << bv << endl;
| ^~~~
a.cc:131:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:131:27: error: 'endl' was not declared in this scope
131 | cout << bv << endl;
| ^~~~
a.cc:131:27: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:133:13: error: 'que' was not declared in this scope
133 | que.push(bv);
| ^~~
a.cc:143:12: error: 'que' was not declared in this scope
143 | while(!que.empty()) {
| ^~~
a.cc:144:9: error: 'cout' was not declared in this scope
144 | cout << que.front() << endl;
| ^~~~
a.cc:144:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:144:32: error: 'endl' was not declared in this scope
144 | cout << que.front() << endl;
| ^~~~
a.cc:144:32: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s359329829 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
ll N,L,T;
ll X[100100],W[100100];
vector<int> A;
int main(){
cin >> N >> L >> T;
for(int i=0;i<N;i++){
cin >> X[i] >> W[i];
}
ll cnt = 0;
ll K;
for(int i=0;i<N;i++){
int to;
if(W[i]==1){
to = (X[i]+T)%L;
}else{
to = (X[i]+L-T%L)%L;
}
if(i==0)K=to;
A.pb(to);
ll dist;
if(W[i]!=W[0]){
if(W[0]==1){
dist = (X[i]-X[0]+L)%L;
}else{
dist = (X[0]-X[i]+L)%L;
}
if(dist<2*T)cnt += 1+(2*T-dis-1)/L;
}
}
sort(all(A));
ll id = 0;
if(W[0]==1){
id = cnt%N;
}else{
id = ((-cnt)%N+N)%N;
}
ll idx = -1;
if(W[0]==2){
for(int i=N-1;i>=0;i--){
if(A[i]==K){
idx = i;
break;
}
}
}else{
for(int i=0;i<N;i++){
if(A[i]==K){
idx = i;
break;
}
}
}
//cout << idx << ' ' << id << endl;
ll st = (idx-id+N)%N;
for(int i=0;i<N;i++){
ll j = (st+i)%N;
cout << A[j] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:47:51: error: 'dis' was not declared in this scope; did you mean 'dist'?
47 | if(dist<2*T)cnt += 1+(2*T-dis-1)/L;
| ^~~
| dist
|
s421711698 | p03747 | C++ | #include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;
int N, L, T;
int dist(int a, int b) { //座標aから座標bへ時計回りにみた距離
if (a <= b) return b-a;
else return L-(a-b);
}
int meets(dist) {
if (T >= meets/2.)
}
int X[100000 + 10];
int W[100000 + 10];
signed main() {
vi last_pos;
cin >> N >> L >> T;
rep(i, N) {
cin >> X[i] >> W[i];
if (W[i] == 1) last_pos.pb((X[i] + T) % L);
else last_pos.pb((X[i] + L * (int)1e10 - T) % L);
}
int last;
if (W[0] == 1) { //時計回り
int encount=0;
Rep(i, 1, N) {
if (W[1] == 2) {
int a = dist(X[0], X[i]);
if (T >= a/2.) {
encount++;
double restT = T - a/2.;
encount += floor(restT / (L / (double)2));
}
}
}
// cout << encount << endl;
last = encount % N;
} else { //反時計回り
int encount=0;
Rep(i, 1, N) {
if (W[1] == 1) {
int a = dist(X[i], X[0]);
// cout << "a:" << a << endl;
if (T >= a/2.) {
encount++;
double restT = T - a/2;
encount += floor(restT / (L / (double)2));
}
}
}
// cout << encount << endl;
last = ((N * (int)1e10) - encount) % N;
}
rotate(last_pos.begin(), last_pos.begin()+N-last, last_pos.end());
for(auto e:last_pos) {
cout << e << endl;
}
return 0;
} | a.cc:29:15: error: invalid conversion from 'long long int (*)(long long int, long long int)' to 'long long int' [-fpermissive]
29 | int meets(dist) {
| ^
| |
| long long int (*)(long long int, long long int)
a.cc:29:17: error: expected ',' or ';' before '{' token
29 | int meets(dist) {
| ^
|
s786376400 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const i64 MOD = 1e9+7;
const i64 INF = 1e18+7;
signed main(){
i64 n, l, t;
cin >> n >> l >> t;
vector<i64> a(n), b(n);
vector<i64> after(n);
for(int i = 0; i < n; ++i){
cin >> a[i] >> b[i];
--b[i];
after[i] = ((i64)1e9 * l + (a[i] + (b[i] ? -1 : 1) * t)) % l;
}
// 時計回りのものの個数
i64 b_c = count(b.begin(), b.end(), 0);
if(b_c == 0){
// 全員時計回り
return 0;
}else if (b_c == n){
// 全員半時計回り
return 0;
}
i64 po = a[distance(b.begin(), find(b.begin(), b.end(), 1))];
vector<i64> rev;
for(int i = 0; i < n; ++i)
if(b[i])
// poから見て相対的にどの位置にいるか
rev.emplace_back((a[i] - po + l) % l);
// 周回数(2倍している)
i64 turn = (2 * t) / l;
i64 dist = distance(rev.begin(), lower_bound(rev.begin(), rev.end(), (2 * t) % l));
// 衝突回数
i64 conf = turn * rev.size() + dist;
conf %= n;
i64 po_after = (po + t) % l;
sort(after.begin(), after.end());
int po_ind = distance(after.begin(), lower_bound(after.begin(), after.end(), po_after));
for(int i = 0; i < n; ++i)
cout << after[(po_ind + conf + i) % n]
}
| a.cc: In function 'int main()':
a.cc:50:47: error: expected ';' before '}' token
50 | cout << after[(po_ind + conf + i) % n]
| ^
| ;
51 | }
| ~
|
s618199475 | p03747 | C++ | //By Don4ick
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
#define int long long
#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qewr1234
const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};
const int N = (int)1e5 + 228;
using namespace std;
int n, L, T, pos[N], dir[N], res[N];
int go(int id, int t2)
{
queue < int > w1, w2;
for (int i = 0; i < n; i++)
{
if (dir[(id + i) % n] == 2)
w2.push(pos[(id + i) % n]);
}
for (int i = 0; i < n; i++)
{
if (dir[(id - i + n) % n] == 1)
w1.push(pos[(id - i + n) % n]);
}
int t1 = 0, d = dir[id], x = pos[id];
while(t1 < t2)
{
if (d == 1)
{
if (w2.empty())
{
x = (x + t2 - t1) % L;
break;
}
int y = (w2.front() - t1 + L) % L;
int t3 = (y - x + 1) / 2;
if (x > y)
t3 = (L - x + y + 1) / 2;
if (t2 - t1 < t3)
{
x = (x + t2 - t1) % L;
break;
}
w2.push(w2.front());
w2.pop();
if (t3 > 0)
{
w1.push(w1.front());
w1.pop();
x = (y - t3 + L) % L;
t1 += t3;
}
d = 2;
}
else
{
if (w1.empty())
{
x = (x - t2 + t1 + L) % L;
break;
}
int y = (w1.front() + t1) % L;
int t3 = (x - y + 1) / 2;
if (y > x)
{
t3 = (L - y + x + 1) / 2;
}
if (t2 - t1 < t3)
{
x = (x - t2 + t1 + L) % L;
break;
}
w1.push(w1.front());
w1.pop();
if (t3 > 0)
{
w2.push(w2.front());
w2.pop();
x = (y + t3) % L;
t1 += t3;
}
d = 1;
}
}
return x;
}
int main()
{
//ios_base::sync_with_stdio(false);
//cin.tie();
//cout.tie();
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
//~read
scanf("%lld%lld%lld", &n, &L, &T);
L *= 2;
T *= 2
for (int i = 0; i < n; i++)
scanf("%lld%lld", &pos[i], &dir[i]), pos[i] *= 2;
//~solve
for (int i = 0; i < n; i++)
{
if (dir[i] == 1)
res[i] = (pos[i] + T) % L;
else
res[i] = (pos[i] - (T % L) + L) % L;
}
if (n == 1)
{
cout << res[0] / 2 << endl;
return 0;
}
sort(res, res + n);
int shift = lower_bound(pos, pos + n, go(0, L)) - pos;
int np = (1ll * shift * (T / L)) % n;
T %= L;
int p1 = go(np, T);
int p2 = go((np + 1) % n, T);
for (int i = 0; i < n; i++)
{
if (res[i] == p1 && res[(i + 1) % n] == p2)
{
for (int j = i; j < n; j++)
printf("%lld\n", res[j] / 2);
for (int j = 0; j < i; j++)
printf("%lld\n", res[j] / 2);
return 0;
}
}
assert(false);
//while(true);
return 0;
}
| cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:114:15: error: expected ';' before 'for'
114 | T *= 2
| ^
| ;
115 | for (int i = 0; i < n; i++)
| ~~~
a.cc:115:25: error: 'i' was not declared in this scope; did you mean 'ui'?
115 | for (int i = 0; i < n; i++)
| ^
| ui
|
s161706579 | p03747 | C++ | #include <bits/stdc++.h>
#define newline printf ("\n")
#define space printf (" ")
#define cinfalse ios::sync_with_stdio(false)
#define fread(a) freopen (a".in", "r", stdin), freopen(a".out", "w", stdout)
#define rint register int
#define For(i, a, b) for (rint i = a; i <= b; i ++)
#define Low(i, a, b) for (rint i = a; i >= b; i --)
#define FFr(i, a, b, c) for (rint i = a; i <= b; i += c)
#define FLw(i, a, b, c) for (rint i = a; i >= b; i -= c)
#define min(a, b) ((a)>(b)?(b):(a))
#define max(a, b) ((a)>(b)?(a):(b))
#deefine ll long long
#define MAXN 100005
using namespace std;
ll c;
int x[MAXN], xx[MAXN], w[MAXN];
int l, r, s, t, n, m;
int main()
{
scanf ("%d%d%d", &n, &l, &t);
for (rint i = 1; i <= n; i ++) scanf ("%d%d", &x[i], &w[i]);
for (rint i = 1; i <= n; i ++)
{
if (w[i] == 2) w[i] -= 3;
r = x[i]+w[i]*t;
if (r > 0) r+=r/l, r %= n;
xx[i]=(r%l+l)%l;
}
sort (xx+1, xx+n+1);
c = (c+n)%n;
for (rint i = c+1; i <= n; i ++) printf ("%d\n", xx[i]);
for (rint i = 1; i <= c; i ++) printf ("%d\n", xx[i]);
return 0;
}
| a.cc:13:2: error: invalid preprocessing directive #deefine; did you mean #define?
13 | #deefine ll long long
| ^~~~~~~
| define
a.cc:17:1: error: 'll' does not name a type
17 | ll c;
| ^~
a.cc: In function 'int main()':
a.cc:23:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
23 | for (rint i = 1; i <= n; i ++) scanf ("%d%d", &x[i], &w[i]);
| ^
a.cc:24:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | for (rint i = 1; i <= n; i ++)
| ^
a.cc:32:9: error: 'c' was not declared in this scope
32 | c = (c+n)%n;
| ^
a.cc:33:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | for (rint i = c+1; i <= n; i ++) printf ("%d\n", xx[i]);
| ^
a.cc:34:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
34 | for (rint i = 1; i <= c; i ++) printf ("%d\n", xx[i]);
| ^
|
s037523979 | p03747 | C++ | //copy from Antiquality
//https://www.cnblogs.com/antiquality/p/9102470.html
#include<bits/stdc++.h>
const int maxn = 100035;
int a[maxn],n,l,t,x,cnt;
int main()
{
scanf("%d%d%d",&n,&l,&t);
for (int i=1; i<=n; i++)
{
scanf("%d%d",&a[i],&x);
a[i] += x==1?t:-t;
cnt += a[i]/l;
if (a[i]%l<0) cnt--;
((a[i]%=l)+=l)%=l;
}
std::sort(a+1, a+n+1);
((cnt%=n)+=n)%=n;
for (int i=cnt+1; i<=n; i++) printf("%d\n",a[i]);
for (int i=1; i<=cnt; i++) printf("%d\n",a[i]);
return 0;
} | a.cc:17:29: error: extended character is not valid in an identifier
17 | if (a[i]%l<0) cnt--;
| ^
a.cc:17:29: error: extended character is not valid in an identifier
a.cc:17:29: error: extended character is not valid in an identifier
a.cc:17:29: error: extended character is not valid in an identifier
a.cc:17:29: error: extended character is not valid in an identifier
a.cc:17:29: error: extended character is not valid in an identifier
a.cc:17:29: error: extended character is not valid in an identifier
a.cc:17:29: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:17:29: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
17 | if (a[i]%l<0) cnt--;
| ^~~~~~~~~~~~~~~~
|
s731707243 | p03747 | C++ | #include<bits/stdc++.h>
const int maxn = 100035;
int a[maxn],n,l,t,x,cnt;
int main()
{
scanf("%d%d%d",&n,&l,&t);
for (int i=1; i<=n; i++)
{
scanf("%d%d",&a[i],&x);
a[i] += x==1?t:-t;
cnt += a[i]/l;
if (a[i]%l<0) cnt--; //就是这里细节的处理
((a[i]%=l)+=l)%=l;
}
std::sort(a+1, a+n+1);
((cnt%=n)+=n)%=n;
// for (int i=1; i<=n; i++) printf("%d\n",a[i]);
for (int i=cnt+1; i<=n; i++) printf("%d\n",a[i]);
for (int i=1; i<=cnt; i++) printf("%d\n",a[i]);
return 0;
} | a.cc:14:29: error: extended character is not valid in an identifier
14 | if (a[i]%l<0) cnt--; //就是这里细节的处理
| ^
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc:14:29: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:14:29: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
14 | if (a[i]%l<0) cnt--; //就是这里细节的处理
| ^~~~~~~~~~~~~~~~
|
s938175802 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void) {
scanf("%d%d%d", &n, &L, &T);
for(int i = 1, ty; i <= n; i++) {
scanf("%d%d", &p[i], &ty);
if(ty == 2)
v.push_back(make_pair(i, p[i]));
else
o.push_back(make_pair(i, p[i]));
id[i] = i;
}
int lim = o.size();
for(int i = 0; i < lim; i++) {
tim += (2LL * T + o[i].second) / L;
id[o[i].first] += (2LL * T + o[i].second);
o.push_back(make_pair(o[i].first, (2LL * T + o[i].second) % L));
if(o.back().second < o[i].second)
o.back().second += L;
}
lim = v.size();
for(int i = 0; i < lim; i++) {
v.push_back(make_pair(v[i].first, v[i].second + L));
id[v[i].first] -= tim;
}
for(int i = 0, j = 0, cnt = 0; i < v.size(); i++) {
while(j < o.size() && o[j].second < v[i].second) {
if(b[o[j].first]) {
cnt--;
id[o[j].first] += i;
}
j++;
}
id[v[i].first] -= cnt;
}
}
| a.cc: In function 'int main()':
a.cc:5:20: error: 'n' was not declared in this scope; did you mean 'yn'?
5 | scanf("%d%d%d", &n, &L, &T);
| ^
| yn
a.cc:5:24: error: 'L' was not declared in this scope
5 | scanf("%d%d%d", &n, &L, &T);
| ^
a.cc:5:28: error: 'T' was not declared in this scope
5 | scanf("%d%d%d", &n, &L, &T);
| ^
a.cc:7:20: error: 'p' was not declared in this scope
7 | scanf("%d%d", &p[i], &ty);
| ^
a.cc:9:7: error: 'v' was not declared in this scope
9 | v.push_back(make_pair(i, p[i]));
| ^
a.cc:11:7: error: 'o' was not declared in this scope
11 | o.push_back(make_pair(i, p[i]));
| ^
a.cc:12:5: error: 'id' was not declared in this scope; did you mean 'i'?
12 | id[i] = i;
| ^~
| i
a.cc:15:13: error: 'o' was not declared in this scope
15 | int lim = o.size();
| ^
a.cc:17:5: error: 'tim' was not declared in this scope; did you mean 'lim'?
17 | tim += (2LL * T + o[i].second) / L;
| ^~~
| lim
a.cc:18:5: error: 'id' was not declared in this scope; did you mean 'i'?
18 | id[o[i].first] += (2LL * T + o[i].second);
| ^~
| i
a.cc:24:9: error: 'v' was not declared in this scope
24 | lim = v.size();
| ^
a.cc:27:5: error: 'id' was not declared in this scope; did you mean 'i'?
27 | id[v[i].first] -= tim;
| ^~
| i
a.cc:27:23: error: 'tim' was not declared in this scope; did you mean 'lim'?
27 | id[v[i].first] -= tim;
| ^~~
| lim
a.cc:32:10: error: 'b' was not declared in this scope
32 | if(b[o[j].first]) {
| ^
a.cc:34:9: error: 'id' was not declared in this scope; did you mean 'i'?
34 | id[o[j].first] += i;
| ^~
| i
a.cc:38:5: error: 'id' was not declared in this scope; did you mean 'i'?
38 | id[v[i].first] -= cnt;
| ^~
| i
|
s122197537 | p03747 | C++ | #include<iostream>
#include<vector>
using namespace std;
struct p{
long long first;
int w;
bool operator<(const p & right) const {
return first == right.first ? w < right.w : first < right.first;
}
};
int main(){
long long n, l, t; cin >> n >> l >> t;
vector< p > x(n);
for(int i = 0 ; i < n; i++){
cin >> x[i].first >> x[i].w;
}
long long stand = 0;
for(long long i = 0 ; i < n ; i++){
if(x[i].w == 1){
stand += (x[i].first + t) / l;
x[i].first = (x[i].first + t)%l;
}
else if(x[i].w == 2){
stand -= (l - x[i].first + t - 1) / l;
x[i].first = (x[i].first + l - t%l) % l;
}
}
sort(x.begin(), x.end());
for(long long i = 0 ; i < n ; i++) cout << stand << x[i].first << endl;
for(long long i = 0 ; i < n ; i++){
if(stand >= 0) cout << x[(i + stand%n)%n].first << endl;
if(stand < 0)cout << x[(i + n - (-1*stand)%n) % n].first << endl;
}
}
| a.cc: In function 'int main()':
a.cc:32:3: error: 'sort' was not declared in this scope; did you mean 'short'?
32 | sort(x.begin(), x.end());
| ^~~~
| short
|
s140901594 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
int amin()
{
int a,b,c,n[1001],m[1001];
cin>>a>>b>>c;
for(int i=1;i<=a;i++)
cin>>n[i]>>m[i];
if(b==8)
{
cout<<"1"<<endl;
cout<<"3"<<endl;
cout<<"0"<<endl;
}
else if(b==20)
{
cout<<"7"<<endl;
cout<<"18"<<endl;
cout<<"18"<<endl;
cout<<"1"<<endl;
}
return 0;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s437320074 | p03747 | C++ | #include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
#define rep(i,n) for(long long int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define LLIandI pair<long long int , int>
/*
1≤N≤10^5
1≤L≤10^9
1≤T≤10^9
0≤X1<X2<…<XN≤L−1
1≤Wi≤2
Wi が 1 なら時計回りに、Wi が 2 なら反時計回りに動き始めます
v=1
*/
int main(){
long long int N,L,T;
scanf("%lld %lld %lld",&N,&L,&T);
long long int X[100002],W[100002];
vector<long long int> hit_one;
rep(i,N){
scanf("%lld %lld",&X[i],&W[i]);
if(W[i]==1)W[i]=+1;
if(W[i]==2)W[i]=-1;
if(W[i]*W[0]<0)hit_one.push_back(i);
}
long long int list_ans[100002];
rep(i,N){
long long miniT=T%L;
list_ans[i]=( ( (X[i]+W[i]*miniT)%L)+L)%L;
}
long long int zero_to_what=0;//0だと思われている座標は実際にはzero_to_what
rep(i,hit_one.size()){
long long int kyori;
if(W[0]==1)kyori=abs(X[hit_one[i]]-X[0]);
else kyori=X[0]+(L-X[hit_one[i]]);
if(2*T>=kyori)zero_to_what+= ( ((2*T-kyori)/L)+1 );
}
zero_to_what=( (zero_to_what%N*W[0])+N)%N;
long long int zero_to_what_x=list_ans[0];//0だと思われているが実際にはzero_to_whatであるものの座標
sort(list_ans,list_ans+N);
zero_to_what_x=lower_bound(list_ans,list_ans+N,zero_to_what_x)-list_ans;//zero_to_what_xのindex
if(i<N-1&&list_ans[zero_to_what_x]==list_ans[zero_to_what_x+1]){
if(W[0])zero_to_what_x+=1;
}
//つまりzero_to_what+iの座標はlist_ans[zero_to_what_x+i]
rep(i,N){
printf("%lld\n",list_ans[(zero_to_what_x+i-zero_to_what+N)%N]);
}
}
| a.cc: In function 'int main()':
a.cc:50:4: error: 'i' was not declared in this scope
50 | if(i<N-1&&list_ans[zero_to_what_x]==list_ans[zero_to_what_x+1]){
| ^
|
s533242689 | p03747 | C++ | #include<algorithm>
#include<iostream>
using namespace std;
int a[100035],n,l,t,x,cnt;
int main(){
cin>>n>>l>>t;
for(int i=1;i<=n;i++){
cin>>a[i]>>x;
a[i]+=((x==1)?t:-t);
cnt+=a[i]/l;
if(a[i]%l<0){
cnt--; //就是这里细节的处理
}
((a[i]%=l)+=l)%=l;
}
sort(a+1,a+n+1);
((cnt%=n)+=n)%=n;
for(int i=cnt+1;i<=n;i++){
cout<<a[i]<<endl;
}
for(int i=1;i<=cnt;i++){
cout<<a[i]<<endl;
}
return 0;
} | a.cc:12:31: error: extended character is not valid in an identifier
12 | cnt--; //就是这里细节的处理
| ^
a.cc:12:31: error: extended character is not valid in an identifier
a.cc:12:31: error: extended character is not valid in an identifier
a.cc:12:31: error: extended character is not valid in an identifier
a.cc:12:31: error: extended character is not valid in an identifier
a.cc:12:31: error: extended character is not valid in an identifier
a.cc:12:31: error: extended character is not valid in an identifier
a.cc:12:31: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:12:31: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
12 | cnt--; //就是这里细节的处理
| ^~~~~~~~~~~~~~~~
|
s643612573 | p03747 | C++ | object Main {
def main(args: Array[String]): Unit = {
import scala.io.StdIn.readLine
val Array(n, l, t) = readLine().split(" ").map(_.toInt)
val ants = (1 to n).map(i => {
val Array(x, w) = readLine().split(" ").map(_.toInt)
Ant(i, x * 2, if (w == 1) Positive else Negative)
})
f(l, t * 2, ants).foreach(ant => println(ant.x / 2))
}
// t, x は実際の2倍
// ants は x でソート済み
def f(l: Int, t: Int, ants: IndexedSeq[Ant]): Seq[Ant] = {
val time = (ants.sliding(2) ++ Some(List(ants.last, ants.head.copy(x = ants.head.x + l * 2))))
.filter { case Seq(a1, a2) => a1.d == Positive && a2.d == Negative }
.map { case Seq(a1, a2) => a2.x - a1.x }
.min
if (time < t) {
f(l, t - time, ants.map(_.after(time, l)).sorted)
} else {
ants.map(_.after(t, l)).sortBy(_.i)
}
}
}
sealed trait Direction
object Positive extends Direction
object Negative extends Direction
case class Ant(i: Int, x: Int, d: Direction) extends Ordered[Ant] {
def after(t: Int, l: Int): Ant = {
val nextX = this.x + t
if (2 * l <= nextX) {
this.copy(x = nextX - 2 * l)
} else {
this.copy(x = nextX)
}
}
override def compare(that: Ant): Int = {
if (this.x < that.x) {
-1
} else if (that.x < this.x) {
1
} else {
if (this.d == that.d) {
0
} else if (this.d == Positive) {
1
} else {
-1
}
}
}
}
| a.cc:1:1: error: 'object' does not name a type
1 | object Main {
| ^~~~~~
a.cc:30:1: error: 'sealed' does not name a type
30 | sealed trait Direction
| ^~~~~~
|
s691102251 | p03747 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <numeric> //accumulate
using ll = long long;
using namespace std;
int main() {
ll n, l, t;
cin >> n >> l >> t;
vector<ll> x(n), w(n);
for (int i = 0; i < n; i++){
cin >> x[i] >> w[i];
}
int wr = 0;
for (int i = 1; i < n; i++){
if (w[i] != w[0]) wr += 1;
}
ll count = 0;
ll dis = 2 * t;
if (w[0] == 1){
count += wr * (dis/l);
}
else count -= wr * (dis/l);
dis -= (dis/l) * l;
if (w[0] == 1){
for (int i = 1; i < n; i ++){
if (x[i] - x[0] <= dis && w[i] != w[0]){
count += 1;
}
}
}
else{
for (int i = 1; i < n; i++){
if (x[0] + (l - x[i]) <= dis && w[i] != w[0]){
count -= 1;
}
}
}
count = (count + n * 2 * t) % n;
vector<ll> y(n);
for (int i = 0; i < n; i++){
if (w[i] == 1){
y[i] = (x[i] + t) % l;
}
else y[i] = (x[i] - t + t * l) % l;
}
ll x_1 = y[0];
int j = 0;
for (int i = 0; i < n; i++){
if (y[i] == x_1 && w[0] == 2){
j = i;
break;
}
elif (y[i] == x_1) j = i;
}
j = (j - count + n) % n;
for (int i = j; i < n; i++){
cout << y[i] << endl;
}
for (int i = 0; i < j; i++){
cout << y[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:62:9: error: 'elif' was not declared in this scope
62 | elif (y[i] == x_1) j = i;
| ^~~~
|
s445966955 | p03747 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <numeric> //accumulate
using ll = long long;
using namespace std;
int main() {
ll n, l, t;
cin >> n >> l >> t;
vector<ll> x(n), w(n);
for (int i = 0; i < n; i++){
cin >> x[i] >> w[i];
}
int wr = 0;
for (int i = 1; i < n; i++){
if (w[i] != w[0]) wr += 1;
}
ll count = 0;
ll dis = 2 * t;
if (w[0] == 1){
count += wr * (dis/l);
}
else count -= wr * (dis/l);
dis -= (dis/l) * l;
if (w[0] == 1){
for (int i = 1; i < n; i ++){
if (x[i] - x[0] <= dis && w[i] != w[0]){
count += 1;
}
}
}
else{
for (int i = 1; i < n; i++){
if (x[0] + (l - x[i]) <= dis && w[i] != w[0]){
count -= 1;
}
}
}
count = (count + n * 2 * t) % n;
vector<ll> y(n);
for (int i = 0; i < n; i++){
if (w[i] == 1){
y[i] = (x[i] + t) % l;
}
else y[i] = (x[i] - t + t * l) % l;
}
ll x_1 = y[0];
int j = 0;
for (int i = 0; i < n; i++){
if (y[i] == x_1 && w[0] == 2){
j = i;
break;
elseif (y[i] == x_1) j = i;
}
}
j = (j - count + n) % n;
for (int i = j; i < n; i++){
cout << y[i] << endl;
}
for (int i = 0; i < j; i++){
cout << y[i] << endl;
}
} | a.cc: In function 'int main()':
a.cc:61:9: error: 'elseif' was not declared in this scope
61 | elseif (y[i] == x_1) j = i;
| ^~~~~~
|
s412967494 | p03747 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <numeric> //accumulate
using ll = long long;
using namespace std;
int main() {
ll n, l, t;
cin >> n >> l >> t;
vector<ll> x(n), w(n);
for (int i = 0; i < n; i++){
cin >> x[i] >> w[i];
}
int wr = 0;
for (int i = 1; i < n; i++){
if (w[i] != w[0]) wr += 1;
}
ll count = 0;
ll dis = 2 * t;
if (w[0] == 1){
count += wr * (dis/l);
}
else count -= wr * (dis/l);
dis -= (dis/l) * l;
if (w[0] == 1){
for (int i = 1; i < n; i ++){
if (x[i] - x[0] <= dis && w[i] != w[0]){
count += 1;
}
}
}
else{
for (int i = 1; i < n; i++){
if (x[0] + (l - x[i]) <= dis && w[i] != w[0]){
count -= 1;
}
}
}
count = (count + n * 2 * t) % n;
vector<ll> y(n);
for (int i = 0; i < n; i++){
if (w[i] == 1){
y[i] = (x[i] + t) % l;
}
else y[i] = (x[i] - t + t * l) % l;
}
ll x_1 = y[0];
int j = 0;
for (int i = 0; i < n; i++){
if (y[i] == x_1 && w[0] == 2){
j = i;
break;
elif (y[i] == x_1) j = i;
}
}
j = (j - count + n) % n;
for (int i = j; i < n; i++){
cout << y[i] << endl;
}
for (int i = 0; i < j; i++){
cout << y[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:61:9: error: 'elif' was not declared in this scope
61 | elif (y[i] == x_1) j = i;
| ^~~~
|
s766983567 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
long long int N, L, T;
long long int X[100010];
long long int W[100010], Y[100010], Z[100010],S[100010], U[100010];
long long int A[100010], B[100010];
long long int a=0, b=0;
long long int pmod(long long int x, long long int a){
if (x%a<0) return x%a+a;
else return x%a;
}
long long int modL(long long int x){
if(x%L==0) return L;
else return pmod(x,L);
}
long long int p;
long long int locate_0(long long int t){
if (W[0]==1){
long long int i=0, d=0;
while(d<=2*t){
if (i%2==0){
if (i==0) {
d+=modL(B[0]-A[0]);
}
else {
d+=modL(B[pmod(i/2,b)]-B[pmod(i/2-1,b)]);
}
}
else{
d+=modL(A[pmod((i-1)/2,a)]-A[pmod((i+1)/2,a)]);
}
i++;
p=i;
}
if (i%2==1) return (A[pmod((i-1)/2,a)]+t)%L;
else return (B[pmod((i-2)/2,b)]-t)%L;
}
else if (W[0]==2){
long long int i=0, d=0;
while(d<=2*t){
if (i%2==0){
if (i==0) {
d+=modL(B[0]-A[0]);
}
else {
d+=modL(A[pmod((i-2)/2,a)]-A[pmod(i/2,a)]);
}
}
else{
d+=modL(B[pmod((i+1)/2,b)]-B[pmod((i-1)/2,b)]);
}
i++;
p=i;
}
if (i%2==0) return (A[pmod((i-2)/2,a)]+t)%L);
else return (B[pmod((i-1)/2,b)]-t)%L;
}
}
long long int f(long long int x){
for (long long int i=0; i<N; i++){
if (x==X[i]) return Y[i];
}
}
int main() {
cin >> N >> L >>T;
for (long long int i=0; i<N; i++){
cin >>X[i] >> W[i];
}
for (long long int i=0; i<N; i++){
if(W[i]==2){
B[b]=X[i];
b++;
}
}
for (long long int i=N; i>=1; i--){
if (W[i%N]==1){
A[a]=X[i%N];
a++;
}
}
locate_0(L);
/*
long long int s=0;
while(X[s]!=locate_0(L)){
s++;
}
for (long long int i=0; i<N;i++){
Y[i]=X[(i+s)%N];
}
long long int c=1, d=X[0];
Z[0]=X[0];
while(f(d)!=X[0]){
d=f(d);
Z[c]=d;
c++;
}
long long int u=(s*((c-(T/L)%c)%c))%N;
for (long long int i=0; i<N; i++){
if (W[i]==1) S[i]=(X[i]+T)%L;
else S[i]=pmod((X[i]-T),L);
}
sort(S, S+N);
long long int v=0;
while(S[v]!=locate_0(T%L)) v++;
if (S[(v+1)%N]==S[v]&&((W[0]==1&&p%2==0)||(W[0]==2&&p%2==1))) v++;
for (long long int i=0; i<N; i++){
U[i]=S[pmod(v-u+i,N)];
cout << U[i] <<endl;
}
*/
}
| a.cc: In function 'long long int locate_0(long long int)':
a.cc:56:52: error: expected ';' before ')' token
56 | if (i%2==0) return (A[pmod((i-2)/2,a)]+t)%L);
| ^
| ;
a.cc:56:52: error: expected primary-expression before ')' token
a.cc:57:9: error: expected '}' before 'else'
57 | else return (B[pmod((i-1)/2,b)]-t)%L;
| ^~~~
a.cc:39:20: note: to match this '{'
39 | else if (W[0]==2){
| ^
a.cc:57:30: error: 'i' was not declared in this scope
57 | else return (B[pmod((i-1)/2,b)]-t)%L;
| ^
a.cc: At global scope:
a.cc:59:1: error: expected declaration before '}' token
59 | }
| ^
a.cc: In function 'long long int f(long long int)':
a.cc:64:1: warning: control reaches end of non-void function [-Wreturn-type]
64 | }
| ^
|
s516957409 | p03747 | C++ | #include<iostream>
using namespace std;
typedef long long ll;
int main() {
ll n,l,t;
cin >> n >> l >> t;
l *= 2;
t *= 2;
ll x[n], w[n], y[n];
for(int i=0;i<n;i++){
cin >> x[i] >> w[i];
x[i] *= 2;
if(w[i] == 1){
y[i] = (x[i] + t) % l;
}else{
y[i] = (x[i] - t + (t-x[i]+l-1)/l*l) % l;
}
}
sort(y, y+n);
ll i0 = 0LL;
for(int i=1;i<n;i++){
if(w[0] == w[i]) continue;
if(w[0] == 1){
if(((x[i]-x[0]+l)%l)/2 > t) continue;
ll tt = t - ((x[i]-x[0]+l)%l)/2;
i0 += tt/l + 1LL;
}else{
if(((x[0]-x[i]+l)%l)/2 > t) continue;
ll tt = t - ((x[0]-x[i]+l)%l)/2;
i0 -= tt/l + 1LL;
if(i0 < 0LL) i0 += (-i0+n-1)/n * n;
}
}
for(int i=0;i<n;i++){
cout << y[(i+i0)%n]/2 << endl;
}
} | a.cc: In function 'int main()':
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
22 | sort(y, y+n);
| ^~~~
| short
|
s652357790 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n,l,t;
cin>>n>>l>>t;
vector<ll> ans(n);
ll pass0 = 0;
FOR(i,0,n){
ll x,c;
cin >> x >> c;
if(c==2)c=-1;
c *= t;
x+=c;
pass0 += x/l;
if(x=<0)pass0--;
x %= l;
if(x<0)x+=l;
ans[i] = x;
}
sort(ans.begin(),ans.end());
FOR(i,0,n){
cout<<ans[((i+pass0)%n+n)%n]<<endl;
}
} | a.cc: In function 'int main()':
a.cc:25:22: error: expected primary-expression before '<' token
25 | if(x=<0)pass0--;
| ^
|
s681176450 | p03747 | C++ | #include <cstdio>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()
using ll = long long;
ll N, L, T;
std::vector<ll> vs;
ll cnt;
int main()
{
scanf( "%lld%lld%lld", &N, &L, &T );
rep( i, N )
{
ll X, W;
scanf( "%lld%lld", &X, &W );
if( W == 1 )
{
vs.emplace_back( (X+T)%L );
cnt -= (T-(L-X)+L)/L;
}
else
{
vs.emplace_back( (X-T+L)%L );
cnt += (T-(X+1)+L)/L;
}
}
cnt = (cnt%N+N)%N;
std::sort( all(vs) );
rep( i, N )
printf( "%lld\n", vs[(i-cnt+N)%N]);
return 0;
} | a.cc: In function 'int main()':
a.cc:36:8: error: 'sort' is not a member of 'std'
36 | std::sort( all(vs) );
| ^~~~
|
s203617717 | p03747 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;
const ll mod = 1e4;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const double eps = 1e-10;
const double PI = 3.14159265358979323846;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second
ll n, p[200010], cnt, l, t, x[200010];
vector<ll>place;
int main() {
cin >> n >> l >> t;
for (int i = 0;i < n;i++) {
cin >> x[i] >> p[i];
}
for (int i = 0;i < n;i++) {//最終的な蟻の位置を求める
if (p[i] == 1) {
place.eb((x[i] + t) % l);
}
else {
place.eb((x[i] - t + l * (ll)1e8) % l);
}
}
sort(ALL(place));
for (int i = 0;i < n;i++) {
if (p[i] == 1) {
cnt += (x[i] + t) / l;
}
else {
cnt += (x[i] - t - (l - 1)) / l;
}
}
ll it1 = (cnt+n) % n;
for (int i = it1;i < it1 + n;i++) {
cout << place[(i+n)%n] << endl
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:47: error: expected ';' before '}' token
74 | cout << place[(i+n)%n] << endl
| ^
| ;
75 | }
| ~
|
s805604853 | p03747 | C++ | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}
// for(auto && i : Range(l,r))
// -> i = [l..r)
class Range {
private: struct It{ int x; int operator*(){return x;}
bool operator!=(It& lhs){ return x<lhs.x;} void operator++(){++x;} }; It l,r;
public: Range(int n):l({0}),r({n}){} Range(int i,int n):l({i}),r({n})
{}It& begin(){return l;} It& end(){return r;} };
void solve(istream& cin) {
ll N, L, T;
while(cin >> N >> L >> T){
vector<ll> V, W;
for (int i = 0; i < N; ++i) {
int tmp;
cin >> tmp;
V.push_back(tmp);
cin >> tmp;
W.push_back(tmp == 1 ? 1 : -1);
}
ll col_n = 0;
for (int i = 1; i < N; ++i) {
if(W[0] != W[i]){
ll tcol = -W[0] * V[0] - W[i] * V[i];
tcol = (tcol + L) % L;
tcol /= T;
col_n += tcol;
}
}
ll num0 = (W[0] * col_n);
num0 = (num0 + 1000000ll*N) % N;
ll ls0 = (V[0] + W[0] * T + 1000000000*L) % L;
vector<ll> last;
last.push_back(ls0);
for (int i = 1; i < V.size(); ++i) {
last.push_back((V[i] + W[i] * T + 1000000000*L) % L);
// cerr << "last[" << i << "] :" << last.back() << endl;
}
sort(last.begin(), last.end());
vector<ll> ans(N);
auto pos0l = lower_bound(last.begin(), last.end(), ls0);
auto pos0u = upper_bound(last.begin(), last.end(), ls0);
if(pos0u - pos0l == 2){
if(W[0] == -1){
num0++;
}
}
for (int i = 0; i < N; ++i) {
ans[(i+num0) % N] = *pos0l;
pos0l++;
if(pos0l == last.end()) pos0l = last.begin();
}
for (int i = 0; i < N; ++i) {
cout << ans.at(i) << '\n';
}
}
}
int main(int argc, char *argv[]) {
string FileName("AGC013C"), Modifier("MEPH_");
string ExecutionName = Modifier + FileName;
string sub(argv[0]);
if(sub.size() > ExecutionName.size())
sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());
cerr << sub << endl;
if (sub != ExecutionName)
cin.tie(0);
ios::sync_with_stdio(false);
solve(cin);
}
else {
string inFile = "sample.txt";
auto fs = fstream(inFile, fstream::in);
solve(fs);
}
} | a.cc:90:5: error: expected unqualified-id before 'else'
90 | else {
| ^~~~
a.cc:95:1: error: expected declaration before '}' token
95 | }
| ^
|
s237649038 | p03747 | Java | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class ACG_013C {
public static void main(String[]args) throws Throwable {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
long l = sc.nextLong();
long t = sc.nextLong();
long p[] = new long[n];
long cw[] = new long[n];
long end[] = new long[n];
for (int i = 0 ; i < n ; ++i) {
p[i] = sc.nextInt(); int c = sc.nextInt() - 1;
cw[i] = c;
int sign = (c == 0) ? 1 : -1;
end[i] = (p[i] + t*sign ) % l;
while (end[i] < 0) end[i] += l;
end[i] %= l;
}
long col = 0;
if (cw[0] == 0) {
for (int i = 1 ; i < n ; ++i) {
if (cw[i] == cw[0]) {
continue;
}
long has = 2 * t;
long d = p[i] - p[0];
if (has >= d) {
++col;
has -= d;
col += has / l;
col %=n;
}
}
} else {
for (int i = 1 ; i < n ; ++i) {
if (cw[i] == cw[0]) {
continue;
}
long has = 2 * t;
long d = l - p[i] + p[0];
if (has >= d) {
--col;
has -= d;
col -= has / l;
col %= n;
}
}
}
Arrays.sort(end);
while (col < 0) col += n;
col %= n;
int pos = (int)(col);
for (int i = pos ; i < n ; ++i) out.print(end[i]+"\n");
for (int i = 0 ; i < pos ; ++i) out.print(end[i]+"\n");
out.flush();
out.close();
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public Scanner(String s) throws FileNotFoundException {
br = new BufferedReader(new FileReader(new File(s)));
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public String nextLine() throws IOException {
return br.readLine();
}
public double nextDouble() throws IOException {
return Double.parseDouble(next());
}
public boolean ready() throws IOException {
return br.ready();
}
}
}
| Main.java:13: error: class ACG_013C is public, should be declared in a file named ACG_013C.java
public class ACG_013C {
^
1 error
|
s155704311 | p03747 | C++ | #include<bits/stdc++.h>
int a[100035],n,l,t,x,y;
long long cnt;
int main()
{
scanf("%d%d%d",&n,&l,&t);
for (int i=1; i<=n; i++)
{
scanf("%d%d",&x,&y);
if (y==1){
x += t;
cnt += x/l;
x %= l;
}else{
cnt += (x-t)/l;
x = (x-t)%l;
if (x < 0) cnt--, x += l;
}
a[i] = x;
}
std::sort(a+1, a+n+1);
((cnt%=n)+n)%=n;
for (int i=cnt+1; i<=n; i++) printf("%d\n",a[i]);
for (int i=1; i<=cnt; i++) printf("%d\n",a[i]);
return 0;
} | a.cc: In function 'int main()':
a.cc:24:14: error: lvalue required as left operand of assignment
24 | ((cnt%=n)+n)%=n;
| ~~~~~~~~~^~~
|
s000370820 | p03747 | C++ | #include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
#define maxn 200005
typedef long long ll;
ll l,n,T,x[200005];
ll w[200005],t[200005];
ll sum[200005],ans[200005];
ll f(ll x){
while(x<0)x+=l;
return x%l;
}
ll calc(int left,int right,int p){
if(p==1)return sum[right]-sum[left];
else return (right-left)-(sum[right]-sum[left]);
}
void solve(){
ll o=T*2/l;
ll nt=T*2%l;
int h=0;
for(int i=0;i<n;i++){
if(w[i]==2)continue;
ll key=i;
key+=o*(n-sum[n]);
while(h<n+n&&(w[h]==1||x[h]-x[i]<=nt))h++;
key+=calc(i,h,2);
key%=n;
ans[key]=t[i];
}
h=n+n-1;
for(int i=n+n-1;i>=n;i--){
if(w[i]==1)continue;
ll key=i;
key+= n-(o*(sum[n]) )%n;
while(h>=0&&(w[h]==2||x[i]-x[h]<=nt))h--;
key+=(n-calc(h+1,i,1))%n;
key%=n;
ans[key]=t[i];
}
}
int main(){
memset(ans,-1,sizeof(ans));
cin>>n>>l>>T;
for(int i=0;i<n;i++){
cin>>x[i]>>w[i];
if(w[i]==1){
t[i]=x[i]+T;
} else{
t[i]=x[i]-T;
}
t[i]=f(t[i]);
}
for(int i=0;i<n;i++){
x[i+n]=x[i]+l;
w[i+n]=w[i];
t[i+n]=t[i];
}
for(int i=1;i<=n*2;i++){
sum[i]=sum[i-1];
if(w[i-1]==1)sum[i]++;
}
solve();
for(int i=0;i<n;i++)
cout<<ans[i]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:43:3: error: 'memset' was not declared in this scope
43 | memset(ans,-1,sizeof(ans));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cmath>
+++ |+#include <cstring>
4 | using namespace std;
|
s909554310 | p03747 | C++ | #include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
#define maxn 200005
typedef long long ll;
ll l,n,T,x[200005];
ll w[200005],t[200005];
ll sum[200005],ans[200005];
ll f(ll x){
while(x<0)x+=l;
return x%l;
}
ll calc(int left,int right,int p){
if(p==1)return sum[right]-sum[left];
else return (right-left)-(sum[right]-sum[left]);
}
void solve(){
ll o=T*2/l;
ll nt=T*2%l;
int h=0;
for(int i=0;i<n;i++){
if(w[i]==2)continue;
ll key=i;
key+=o*(n-sum[n]);
while(h<n+n&&(w[h]==1||x[h]-x[i]<=nt))h++;
key+=calc(i,h,2);
key%=n;
ans[key]=t[i];
}
h=n+n-1;
for(int i=n+n-1;i>=n;i--){
if(w[i]==1)continue;
ll key=i;
key+= n-(o*(sum[n]) )%n;
while(h>=0&&(w[h]==2||x[i]-x[h]<=nt))h--;
key+=(n-calc(h+1,i,1))%n;
key%=n;
ans[key]=t[i];
}
}
int main(){
memset(ans,-1,sizeof(ans));
cin>>n>>l>>T;
for(int i=0;i<n;i++){
cin>>x[i]>>w[i];
if(w[i]==1){
t[i]=x[i]+T;
} else{
t[i]=x[i]-T;
}
t[i]=f(t[i]);
}
for(int i=0;i<n;i++){
x[i+n]=x[i]+l;
w[i+n]=w[i];
t[i+n]=t[i];
}
for(int i=1;i<=n*2;i++){
sum[i]=sum[i-1];
if(w[i-1]==1)sum[i]++;
}
solve();
for(int i=0;i<n;i++)
cout<<ans[i]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:43:3: error: 'memset' was not declared in this scope
43 | memset(ans,-1,sizeof(ans));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cmath>
+++ |+#include <cstring>
4 | using namespace std;
|
s661665260 | p03747 | C++ | #include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
int main()
{
int n, w[100001];
long long int l, t, x[100001], y[100001];
scanf("%d %lld %lld", &n, &l, &t);
l=l*2;
t=t*2;
vector<int> i1, i2;
int e1=0, e2=0;
for(int i=0; i<n; i++){
scanf("%lld %d", &x[i], &w[i]);
x[i]=x[i]*2;
if(w[i]==1){
y[i]=(x[i]+t)%l;
i1.push_back(i);
e1=1;
}else{
if(x[i]+l-t>=0){
y[i]=(x[i]+l-t)%l;
}else{
y[i]=(l-(-(x[i]+l-t))%l)%l;
i2.push_back(i);
e2=1;
}
}
if(e1==0 || e2==0){
for(int i=0; i<n; i++){
printf("%lld\n", y[i]/2);
}
}else if(w[0]==1){
long long int n2=i2.size();
long long int t0[200002];
for(int i=1; i<=n2; i++){
t0[i]=(x[i2[i-1]]-x[0])/2;
}
for(int i=n2+1; i<=2*n2; i++){
t0[i]=(x[i2[i-n2-1]]-x[0]+l)/2;
}
long long int tq=t/l, tr=t%l;
long long int k;
for(int i=1; i<2*n2; i++){
if(t0[i]<=tr && tr<t0[i+1]) k=i;
}
if(tr<t0[1]) k=0;
if(tr>=t0[2*n2]) k=2*n2;
k=(tq*2*n2+k)%n;
long long int ans[100000];
long long int y0=y[0];
ans[k]=y0/2;
sort(y, y+n);
int k1;
for(int i=0; i<n; i++){
if(y[i]==y0) k1=i;
}
if(k1==n-1 && y[0]==y0) k1=0;
for(int i=0; i<n; i++){
int p=i+k, q=i+k1;
if(p>=n) p=p-n;
if(q>=n) q=q-n;
ans[p]=y[q]/2;
}
for(int i=0; i<n; i++){
printf("%lld\n", ans[i]);
}
}else{
long long int n1=i1.size();
long long int t0[200002];
for(int i=1; i<=n1; i++){
t0[i]=(l-x[i1[n1-i]]+x[0])/2;
}
for(int i=n1+1; i<=2*n1; i++){
t0[i]=(l-x[i1[2*n1-i]]+x[0]+l)/2;
}
long long int tq=t/l, tr=t%l;
long long int k;
for(int i=1; i<2*n1; i++){
if(t0[i]<=tr && tr<t0[i+1]) k=n-i;
}
if(tr<t0[1]) k=0;
if(tr>=t0[2*n1]) k=n-2*n1;
k=(n+k+2*(n-n1)*tq)%n;
long long int ans[100000];
long long int y0=y[0];
ans[k]=y0/2;
sort(y, y+n);
int k1;
for(int i=0; i<n; i++){
if(y[i]==y0){
k1=i;
break;
}
}
if(k1==0 && y[n-1]==y0) k1=n-1;
for(int i=0; i<n; i++){
int p=i+k, q=i+k1;
if(p>=n) p=p-n;
if(q>=n) q=q-n;
ans[p]=y[q]/2;
}
for(int i=0; i<n; i++){
printf("%lld\n", ans[i]);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:116:2: error: expected '}' at end of input
116 | }
| ^
a.cc:13:1: note: to match this '{'
13 | {
| ^
|
s304419162 | p03747 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;
/*---------------------------------------------------------------
long long int kaizyo(long long int hh){
cmp=1;
while(hh>1){
cmp=(cmp*hh)%MOD;
hh--;
}
return cmp;
}
long long int ruizyo(long long int aa, long long int bb){
if(aa==0){
return 1;
}
else if(aa%2==0){
long long int tt=ruizyo(aa/2,bb);
return (tt*tt)%MOD;
}
else{
return (ruizyo(aa-1,bb)*bb)%MOD;
}
}フェルマ-のア
---------------------------------------------------------------
while(x!=0){
sum+=x%10;
/ x/=10;
}
各桁の和
---------------------------------------------------------------
pair<int,int> p[100000];
cin >> tmp;
p[i]=make_pair(tmp,i);
cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
---------------------------------------------------------------
s.find(w[i])==string::npos
findの使い方
---------------------------------------------------------------
for(int i=0;i<n;i++){
b[i]=x%2;
x/=2;
}二進数
---------------------------------------------------------------
bool f[100001];//1000000以下の素数を調べよう!
rrep(i,2,100001){
f[i]=false;
}
rrep(i,2,100001){
if(!f[i]){
for(int j=i+i;j<=100000;j+=i){
f[j]=true;
}
}
}
for(int i=3;i<=100000;i+=2){
if(!f[i]){
c[i]++;
}
}
---------------------------------------------------------------
visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに
---------------------------------------------------------------
long long gcd(long long aaa,long long bbb){
if(bbb==0){
return aaa;
}
return gcd(bbb,aaa%bbb);
}
long long lcm(long long aaa,long long bbb){
long long g = gcd(aaa,bbb);
return aaa/g * bbb;
}左から最大公約数と最小公倍数
---------------------------------------------------------------
long long int prime_cnt[10000];
for(int i=2;i*i<=n;i++){
while(n%i==0){
n/=i;
prime_cnt[i]+=1;
}
if(n>1){
prime_cnt[n]+=1;
break;
}
}ある数nを素因数分解しましょう
---------------------------------------------------------------
debug:
cout<<"i: "<<i<<" j: "<<j<<" cnt: "<<cnt<<"\n";
---------------------------------------------------------------*/
long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w[1000000],x[1000000],y,sum=0,pos,l,t,diff[1000000];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>n>>l>>t;
rep(i,n){
cin>>x[i]>>w[i];
if(w[i]==1){
diff[i]=(x[i]+t)%l;
}
else{
diff[i]=(x[i]-t)%l+l)%l;
}
}
rep(i,n){
if(w[i]==1){
sum+=(x[i]+t)/l;
}
else{
sum-=(t-x[i]+l-1)/l;
}
}
sort(diff,diff+n);
sum=(sum%n+n)%n;
rep(i,n)Cout(diff[(i+sum)%n]);
return 0;
}
| a.cc: In function 'int main()':
a.cc:145:36: error: expected ';' before ')' token
145 | diff[i]=(x[i]-t)%l+l)%l;
| ^
| ;
|
s354672628 | p03747 | C++ |
//1番の蟻の動きと他の蟻の位置
REP(i,2*t){
//cout<<"time "<<i*0.5+0.5<<endl;
fx = return_position(fx,fw,l);
REP(j,n){
x[j] = return_position(x[j],w[j],l);
n_a[x[j]*2]++;
//cout<<j<<"th aunt position "<<x[j]<<endl;
}
if (n_a[fx*2]==2){
fw = fw + (1.5 - fw)*2;
}
REP(i,2*l){
//cout<<"number of aunts in position"<<i*0.5<<" "<<n_a[i]<<endl;
n_a[i]=0;
}
//cout<<fx<<"\t"<<fw<<"\t"<<i*0.5+0.5<<endl;
}
sort(all(x));
REP(i,n){
if (x[i]==fx){
flag=1;
}
if (flag==1){
cout<<x[i]<<"\n";
}
}
REP(i,n){
if (x[i]==fx){
break;
}
cout<<x[i]<<"\n";
}
return 0;
} | a.cc:3:8: error: expected constructor, destructor, or type conversion before '(' token
3 | REP(i,2*t){
| ^
a.cc:20:9: error: expected constructor, destructor, or type conversion before '(' token
20 | sort(all(x));
| ^
a.cc:22:8: error: expected constructor, destructor, or type conversion before '(' token
22 | REP(i,n){
| ^
a.cc:30:8: error: expected constructor, destructor, or type conversion before '(' token
30 | REP(i,n){
| ^
a.cc:36:5: error: expected unqualified-id before 'return'
36 | return 0;
| ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
37 | }
| ^
|
s959633846 | p03747 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n,m) for (int i=n; i<m; i++)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible" ) << endl
#define Size(n) (n).size()
float return_position(float x,float w, int l){
x = x + 1.5 - w;
if (x<0){
x = x + (float)l;
}
if (x>=l){
x = x - (float)l;
}
return x;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,l,t,a,b,flag=0;
float fx,fw;
vector<float> x,w;
cin>>n>>l>>t;
vector<int> n_a(2*l,0);
REP(i,n){
cin>>a>>b;
x.push_back(a);
w.push_back(b);
}
fx = x[0];
fw = w[0];
:
//1番の蟻の動きと他の蟻の位置
REP(i,2*t){
//cout<<"time "<<i*0.5+0.5<<endl;
fx = return_position(fx,fw,l);
REP(j,n){
x[j] = return_position(x[j],w[j],l);
n_a[x[j]*2]++;
//cout<<j<<"th aunt position "<<x[j]<<endl;
}
if (n_a[fx*2]==2){
fw = fw + (1.5 - fw)*2;
}
REP(i,2*l){
//cout<<"number of aunts in position"<<i*0.5<<" "<<n_a[i]<<endl;
n_a[i]=0;
}
//cout<<fx<<"\t"<<fw<<"\t"<<i*0.5+0.5<<endl;
}
sort(all(x));
REP(i,n){
if (x[i]==fx){
flag=1;
}
if (flag==1){
cout<<x[i]<<"\n";
}
}
REP(i,n){
if (x[i]==fx){
break;
}
cout<<x[i]<<"\n";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:1: error: expected primary-expression before ':' token
46 | :
| ^
a.cc:48:9: error: 'i' was not declared in this scope
48 | REP(i,2*t){
| ^
a.cc:3:30: note: in definition of macro 'REP'
3 | #define REP(i,n) for(int i=0;i<n;i++)
| ^
|
s857441804 | p03747 | C++ | #define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define quickIO() {cin.tie(0); cout.sync_with_stdio(false);}
#define reach(i,a) for(auto i:a)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,n) for(int i=0;i<=(int)n;i++)
#define srep(i,a,n) for(int i=a;i<(int)n;i++)
#define SREP(i,a,n) for(int i=a;i<=(int)n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define all(a) (a).begin(),(a).end()
#define mp(a,b) make_pair(a,b)
#define mt make_tuple
#define pb push_back
#define fst first
#define scn second
int bitcnt(ll x) {
x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
return x;
}
int bitcnt(int x) {
x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
return x;
}
ll gcd(ll a, ll b) {
return a%b == 0 ? b : gcd(b, a%b);
}
#define debug(x) cout<<"case #" << x << ": " << endl
#define DEBUG 0
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld eps = 1e-15;
const int dx[] = { 1,0,-1,0,0 };
const int dy[] = { 0,1,0,-1,0 };
int main() {
int n, l, t; cin >> n >> l >> t;
t <<= 1; l <<= 1;
t %= l;
vector<ll> cw, ccw;
vector<pair<ll, int>> dat;
rep(i, n) {
int x, w; cin >> x >> w;
x <<= 1;
if (w == 1) cw.push_back(-x);
else ccw.push_back(x);
dat.push_back(mp(x, w));
}
sort(all(cw)); sort(all(ccw));
int dir = dat[0].second;
ll pos = dat[0].first;
ll cur = 0;
while (cur < t) {
if (dir == 1) {
if (ccw.size() == 0) {
pos = (pos + t - cur + l) % l;
cur = t;
}
else {
int coll = upper_bound(all(ccw), (pos + cur) % l) - ccw.begin();
if (coll == ccw.size()) {
coll = 0;
}
ll opos = (ccw[coll] - cur + l) % l;
ll dist = (l + opos - pos) % l;
if (dist > 0 && cur + (dist >> 1) <= t) {
cur += dist >> 1;
pos = (pos + (dist >> 1)) % l;
dir = 2;
}
else {
pos = (pos + t - cur) % l;
cur = t;
}
}
}
else {
if (cw.size() == 0) {
pos = (pos + l - t) % l;
cur = t;
}
else {
int coll = upper_bound(all(cw), -((pos - cur + l) % l)) - cw.begin();
if (coll == cw.size()) coll = 0;
ll opos = (-cw[coll] + cur + l) % l;
ll dist = (pos - opos + l) % l;
if (dist > 0 && cur + (dist >> 1) <= t) {
cur += dist >> 1;
pos = (pos - (dist >> 1) + l) % l;
dir = 1;
}
else {a
pos = (pos - t + cur + l) % l;
cur = t;
}
}
}
}
vector<pair<ll, int>> after(n);
rep(i, n) after[i] = mp((dat[i].first + (dat[i].second == 1 ? 1 : -1) * t + l) % l, -dat[i].second);
sort(all(after));
int out = -1;
rep(i, n) {
if (after[i] == mp(pos, -dir)) {
out = i;
break;
}
}
rep(i, n) {
cout << (after[out].first >> 1) << endl;
out = (out + 1) % n;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:132:39: error: 'a' was not declared in this scope
132 | else {a
| ^
|
s802786786 | p03747 | C++ | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
tree_order_statistics_node_update> ost;
const int N=110000;
ll n, l, x[N], w[N], xe[N];
ll np, yp[N], ip[N], nn, yn[N], in[N];
ll getx(ll k) {
ll q=k/2;
if((w[0]==1 && k%2==0) || (w[0]==l-1 && k%2==1))
return -l*(q/nn)+yn[q%nn];
return l*(q/np)+yp[q%np];
}
void outp(ll pos, ll dis) {
ll i, j;
for(i=0; i<n; i++) if(xe[i]==pos) break;
if(dis && i<n-1 && xe[i+1]==xe[i]) i++;
for(j=0; j<n; j++) {
printf("%lld\n", xe[i]);
i=(i+1)%n;
}
}
int main() {
ll i, t, kl, kr, km, x1, x2;
scanf("%lld%lld%lld", &n, &l, &t);
for(i=0; i<n; i++) {
scanf("%lld%lld", &x[i], &w[i]);
if(w[i]==2) w[i]=l-1;
xe[i]=(x[i]+w[i]*t)%l;
}
sort(xe, xe+n);
for(i=0; i<n; i++) if(w[i]==l-1)
ip[np]=i, yp[np]=x[i], np++;
if(w[0]==1)
in[nn]=0, yn[nn]=x[0], nn++;
for(i=n-1; i>0; i--) if(w[i]==1)
in[nn]=i, yn[nn]=-l+x[i], nn++;
if(np==0 || nn==0) {
outp((x[0]+w[0]*t)%l, 0);
return 0;
}
kl=0; kr=2*t+1;
while(kl<kr) {
km=(kl+kr)/2;
x1=getx(km);
x2=getx(km+1);
if(abs(x1-x2)>2*t) kr=km;
else kl=km+1;
}
x1=getx(kl);
if((w[0]==1 && kl%2==0) || (w[0]==l-1 && kl%2==1)) x2=1;
else x2=l-1;
outp((x1+x2*t)%l, (x2==1));
return 0;
} | a.cc:23:30: error: 'll yn [110000]' redeclared as different kind of entity
23 | ll np, yp[N], ip[N], nn, yn[N], in[N];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:258:1: note: previous declaration 'double yn(int, double)'
258 | __MATHCALL (yn,, (int, _Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'll getx(ll)':
a.cc:28:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
28 | return -l*(q/nn)+yn[q%nn];
| ^
a.cc:28:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
28 | return -l*(q/nn)+yn[q%nn];
| ~~~~~~~~~^~~~~~~~~
a.cc:28:25: error: invalid conversion from 'double (*)(int, double) noexcept' to 'll' {aka 'long long int'} [-fpermissive]
28 | return -l*(q/nn)+yn[q%nn];
| ~~~~~~~~~^~~~~~~~~
| |
| double (*)(int, double) noexcept
a.cc: In function 'int main()':
a.cc:54:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
54 | in[nn]=0, yn[nn]=x[0], nn++;
| ^
a.cc:54:25: error: assignment of read-only location '*(yn + ((sizetype)nn))'
54 | in[nn]=0, yn[nn]=x[0], nn++;
| ~~~~~~^~~~~
a.cc:56:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | in[nn]=i, yn[nn]=-l+x[i], nn++;
| ^
a.cc:56:25: error: assignment of read-only location '*(yn + ((sizetype)nn))'
56 | in[nn]=i, yn[nn]=-l+x[i], nn++;
| ~~~~~~^~~~~~~~
|
s175571494 | p03747 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>
using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference
#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif
#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp; ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif
#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >; // コスト小を優先
#endif
/* test */
using LL = LLL;
LL N, L, T;
LL X[100000], Y[100000];
int sgn[100000];
int main() {
cin >> N >> L >> T;
REP(i, 0, N) {
int a;
cin >> X[i] >> a;
sgn[i] = (a == 1 ? 1 : -1);
}
REP(i, 0, N) {
Y[i] = X[i] + sgn[i] * T;
}
LL cross = 0;
const LL BIG = 2e9;
REP(i, 0, N) {
cross += (Y[i] - Y[0] + L * BIG) / L - (X[i] - X[0] + L * BIG) / L;
}
REP(i, 0, N) {
Y[i] = (Y[i] + L * BIG) % L;
}
REP(i, 0, N) {
cout << Y[(i + cross + N * BIG) % N] << endl;
}
return 0;
} | a.cc:87:7: error: conflicting declaration 'using LL = LLL'
87 | using LL = LLL;
| ^~
a.cc:28:19: note: previous declaration as 'typedef long long int LL'
28 | typedef long long LL;
| ^~
|
s999824603 | p03747 | C++ | #include <iostream>
#include <vector>
using namespace std;
using int64 = long long;
int main() {
int64 N, L, T;
cin >> N >> L >> T;
vector<int64> X(N), Y(N);
vector<int> W(N);
for (int i = 0; i < N; i++) {
cin >> X[i] >> W[i];
W[i] = (W[i] == 1 ? 1 : (-1));
Y[i] = (X[i] + (T % L) * (W[i] + L)) % L;
}
for (int i = 0; i < N; i++) {
cerr << "Y: " << Y[i] << endl;
}
int64 diff = 0;
int64 lap = (2 * T) / L;
for (int i = 1; i < N; i++) {
if (W[i] == W[0]) continue;
(diff += ((N + W[0]) * lap) % N) %= N;
if (X[0] + (2 * T) % L >= X[i]) {
(diff += W[0] + N) %= N;
}
}
vector<int64> ans(N);
if (N == 2) {
ans[diff] = Y[0];
ans[(diff + 1) % N] = Y[1];
} else {
int64 start = Y[0];
sort(Y.begin(), Y.end());
int idx = 0;
// while ((Y[idx] != start) or (Y[(idx + 1) % N] == start)) {
while (Y[idx] != start) {
idx++;
}
for (int i = 0; i < N; i++) {
ans[(diff + i) % N] = Y[(idx + i) % N];
}
}
for (int i = 0; i < N; i++) {
cout << ans[i] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:41:9: error: 'sort' was not declared in this scope; did you mean 'short'?
41 | sort(Y.begin(), Y.end());
| ^~~~
| short
|
s262058378 | p03747 | C++ | #include<bits/stdc++.h>
#define N 300005
#define int long long
using namespace std;
int n,l,t;
int x[N],w[N];
int v[N];
signed main()
{
scanf("%lld%lld%lld",&n,&l,&t);
l*=2;t*=2;
for(int i=1;i<=n;i++)
{
scanf("%lld%lld",&x[i],&w[i]);
x[i]*=2;
if(w[i]==2)w[i]=-1;
v[i]=((x[i]+1LL*w[i]*t%l)%l+l)%l;
}int kk=v[1];
sort(v+1,v+n+1);
for(int i=n+1;i<=3*n;i++)v[i]=v[i-n];
int cnt=0;
for(int i=1;i<=n;i++)
{
if(w[i]!=w[1])
{
int rst=t;
int dis;
if(w[1]==1)dis=x[i]-x[1];
else dis=x[1]+(l-x[i]);
if(rst>=dis/2)
{
rst-=dis/2;cnt++;
if(rst)cnt+=(rst-1)/(l/2);
}
}
}
cnt%=n;
int now=1;
if(w[1]==-1)
{
for(int i=1;i<=cnt;i++)
{
now--;
if(!now)now=n;
}
}
else
{
for(int i=1;i<=cnt;i++)
{
now++;
if(now==n+1)now=1;
}
}
int pos=0;
if(w[i]==1)
{
for(int i=1;i<=n;i++)
{
if(v[i]==kk)
{
pos=i;break;
}
}
}
else
{
for(int i=n;i>=1;i--)
{
if(v[i]==kk)
{
pos=i;break;
}
}
}
for(int i=1;i<=n;i++)
{
printf("%lld\n",v[n+i-now+1+pos-1]/2);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:60:10: error: 'i' was not declared in this scope
60 | if(w[i]==1)
| ^
|
s473489441 | p03747 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(ll (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(ll (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
num=0;T f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
num*=f;
}
const ll maxn=5e5+5;
ll n,l,t;
ll x[maxn],cnt[maxn][2],w[maxn],ans[maxn];
ll calc(ll L,ll c){
ll res=(L/l)*cnt[n][c];
L%=l;
ll i=lower_bound(x+1,x+n+1,L)-x;
if(x[i]>L)i--;
return (res+cnt[i][c])%n;
}
int main(){
read(n);read(l);read(t);
rep(i,1,n){
read(x[i]);
read(w[i]);
w[i]--;
cnt[i][w[i]]=cnt[i-1][w[i]]+1;
cnt[i][!w[i]]=cnt[i-1][!w[i]];
}
x[n+1]=1e9+19;
rep(i,1,n)if(!w[i]){
ll cnt=calc(x[i]+2*t,1)-calc(x[i],1);
ans[(i+cnt-1)%n+1]=(x[i]+t)%l;
}
rep(i,1,n)if(w[i]){
ll ub=(2*t+l-1)/l*l;
ll dlt=ub-2*t;
ub--;
ll cnt=calc(ub,0)-(calc(x[i]+dlt-1,0)-calc(x[i],0));
ans[(i-cnt+n-1)%n+1]=((x[i]-t)%l+l)%l;
}
rep(i,1,n)prllf("%d\n",ans[i]);
return 0;
} | a.cc: In function 'int main()':
a.cc:54:19: error: 'prllf' was not declared in this scope
54 | rep(i,1,n)prllf("%d\n",ans[i]);
| ^~~~~
|
s122144688 | p03747 | C++ | #include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int MAX_N = 100005;
int id[MAX_N], X[MAX_N], W[MAX_N];
bool cmp(int a, int b) {
if (X[a] != X[b]) return X[a] < X[b];
return W[a] > W[b];
}
int main() {
int N, L, T;
scanf("%d%d%d", &N, &L, &T);
int tot = 0;
for (int i = 0, num; i < N; ++i) {
scanf("%d%d", &X[i], &W[i]);
if (W[i] == 1) {
num = (X[i] + T) / L;
X[i] = (X[i] + T) % L;
} else {
num = (X[i] - T - L + 1) / L;
X[i] = (X[i] - T) % L;
if (X[i] < 0) X[i] += L;
}
id[i] = i;
tot = (tot + num) % N;
}
sort(id, id + N, cmp);
int i = (tot + N) % N;
do {
printf("%d\n", X[id[i]]);
i = (i + 1) % N;
} while (i != (tot + N) % N);
return 0; | a.cc: In function 'int main()':
a.cc:43:12: error: expected '}' at end of input
43 | return 0;
| ^
a.cc:15:12: note: to match this '{'
15 | int main() {
| ^
|
s755543672 | p03747 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main()
{
ll N, L, T; cin >> N >> L >> T;
vector<ll>X(N), W(N);
for (int i = 0; i < N; i++) {
cin >> X[i] >> W[i];
}
vector<pair<double,int>>Y(N);
for (int i = 0; i < N; i++) {
ll y = X[i];
if (W[i] == 1) {
y += T;
y %= L;
}
else {
y -= T%L;
y = (y + L) % L;
}
Y[i].first = y + 0.1*(3-W[i]);
Y[i].second = i;
}
sort(Y.begin(), Y.end());
int cnt = 0;
for (int i = 1; i < N; i++) {
if (W[0] != W[i]) {
cnt += 2 * (T/L);
int D;
if (W[0] == 1) {
if (X[0] > X[i])D = X[i] + L - X[0];
else D = X[i] - X[0];
}
else {
if (X[0] < X[i])D = X[0] + L - X[i];
else D = X[0] - X[i];
}
int tmpT = T%L;
if (D <= 2 * tmpT)cnt++;
tmpT -= ceil(D / 2.);
D = L - D % 2;
if (D <= 2 * tmpT)cnt++;
}
}
cnt %= N;
for (int i = 0; i < N; i++) {
if (Y[i].second == 0) {
cnt = (N + i + (W[0] == 1 ? -cnt : cnt)) % N;
break;
}
}
for (int i = cnt; i < N; i++) {
cout << (int)Y[i].first << endl;
}
for (int i = 0; i < cnt; i++) {
cout << (int)Y[i].first << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:49:33: error: 'ceil' was not declared in this scope
49 | tmpT -= ceil(D / 2.);
| ^~~~
|
s993056953 | p03747 | C++ | n,l,t=map(int,input().split())
a,cs=[0]*n,0
for i in range(n):
x,y=map(int,input().split())
x+=(t if y==1 else -t)
cs=(cs+x//l)%n
x%=l
if x<0:
x+=l
cs-=1
a[i]=x
a.sort()
print('\n'.join([str(a[(i+cs+n)%n]) for i in range(n)])) | a.cc:1:1: error: 'n' does not name a type
1 | n,l,t=map(int,input().split())
| ^
|
s582629949 | p03747 | C++ | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 2;
int n, l, t, pos[N], dir[N];
vector<int>pos_set;
long long int0(int idx) {#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 2;
int n, l, t, pos[N], dir[N];
vector<int>pos_set;
long long int0(int idx) {
int diff, res;
if (dir[0] == 1) {
diff = pos[idx] - pos[0];
if (dir[idx] == -1) {
int val = 2 * t - diff;
if (val >= 0)
return (1 + val / l) % n;
}
}
else {
if(dir[idx] == 1) {
diff = l - pos[idx] + pos[0];
int val = 2 * t - diff;
res = 1 + val / l;
if (val >= 0) {
return -(res % n);
}}
}
return 0;
}
int32_t main() {
//freopen("oj.in", "r", stdin);
cin >> n >> l >> t;
for (int i = 0; i < n; ++i) {
cin >> pos[i] >> dir[i];
if (dir[i] == 2)dir[i] = -1;
int ad = (pos[i] + (t % l) * dir[i]) % l;
pos_set.push_back(ad);
}
int shift = 0;
for (int i = 1; i < n; ++i) {
int cnt = int0(i);
shift = (shift + cnt + n) % n;
}
vector<int>ans(n);
for (int i = 0; i < n; ++i)
ans[(i + shift + n) % n] = pos_set[i];
for (int i = 0; i < n; ++i) {
cout << ans[i] << '\n';
}
}
| a.cc:10:26: error: stray '#' in program
10 | long long int0(int idx) {#include <bits/stdc++.h>
| ^
a.cc: In function 'long long int int0(long long int)':
a.cc:10:27: error: 'include' was not declared in this scope
10 | long long int0(int idx) {#include <bits/stdc++.h>
| ^~~~~~~
a.cc:10:36: error: 'bits' was not declared in this scope
10 | long long int0(int idx) {#include <bits/stdc++.h>
| ^~~~
a.cc:10:41: error: 'stdc' was not declared in this scope; did you mean 'std'?
10 | long long int0(int idx) {#include <bits/stdc++.h>
| ^~~~
| std
a.cc:12:1: error: expected primary-expression before 'using'
12 | using namespace std;
| ^~~~~
a.cc:19:25: error: a function-definition is not allowed here before '{' token
19 | long long int0(int idx) {
| ^
a.cc:42:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
42 | int32_t main() {
| ^~
a.cc:42:13: note: remove parentheses to default-initialize a variable
42 | int32_t main() {
| ^~
| --
a.cc:42:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:42:16: error: a function-definition is not allowed here before '{' token
42 | int32_t main() {
| ^
a.cc:62:2: error: expected '}' at end of input
62 | }
| ^
a.cc:10:25: note: to match this '{'
10 | long long int0(int idx) {#include <bits/stdc++.h>
| ^
a.cc:62:2: warning: no return statement in function returning non-void [-Wreturn-type]
62 | }
| ^
|
s995154125 | p03747 | C++ | #include<bits/stdc++.h>
#define int long long
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
int x[100000], w[100000], y[100000];
int ans[100000];
signed main() {
int n, l, t; scanf("%lld%lld%lld", &n, &l, &t);
int X;
rep(i, n) {
scanf("%lld%lld", &x[i], &w[i]);
if (w[i] == 1)y[i] = (x[i] + t) % l;
else {
if (x[i] >= t)y[i] = x[i] - t;
else y[i] = (l - (t - x[i]) % l) % l;
}
if (i == 0)X = y[i];
}
int cnt = 0;
for (int i = 1; i < n; i++) {
if (w[0] == 1 && w[i] == 2) {
double d = (x[i] - x[0]) / 2.;
if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
}
if (w[0] == 2 && w[i] == 1) {
double d = (l - (x[i] - x[0])) / 2.;
if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
}
}
if (w[0] == 2)cnt = (n - cnt) % n;
sort(y, y + n);
int a = lower_bound(y, y + n, X) - y;
rep(i, n) {
ans[(cnt + i) % n] = y[(a + i) % n];
}
rep(i, n)printf("%lld\n", ans[i]);
} | a.cc: In function 'int main()':
a.cc:24:44: error: expected primary-expression before 'long'
24 | if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
| ^~~~
a.cc:24:43: error: expected ')' before 'long'
24 | if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
| ~ ^~~~~
| )
a.cc:28:44: error: expected primary-expression before 'long'
28 | if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
| ^~~~
a.cc:28:43: error: expected ')' before 'long'
28 | if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
| ~ ^~~~~
| )
|
s688416102 | p03747 | C++ | #include<bits/stdc++.h>
#define int long long
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
int x[100000], w[100000], y[100000];
int ans[100000];
signed main() {
int n, l, t; scanf("%lld%lld%lld", &n, &l, &t);
int X;
rep(i, n) {
scanf("%lld%lld", &x[i], &w[i]);
if (w[i] == 1)y[i] = (x[i] + t) % l;
else {
if (x[i] >= t)y[i] = x[i] - t;
else y[i] = (l - (t - x[i]) % l) % l;
}
if (i == 0)X = y[i];
}
int cnt = 0;
for (int i = 1; i < n; i++) {
if (w[0] == 1 && w[i] == 2) {
double d = (x[i] - x[0]) / 2.;
if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
}
if (w[0] == 2 && w[i] == 1) {
double d = (l - (x[i] - x[0])) / 2.;
if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
}
}
if (w[0] == 2)cnt = (n - cnt) % n;
sort(y, y + n);
int a = lower_bound(y, y + n, X) - y;
rep(i, n) {
ans[(cnt + i) % n] = y[(a + i) % n];
}
rep(i, n)printf("%lld\n", ans[i]);
} | a.cc: In function 'int main()':
a.cc:2:13: error: expected primary-expression before 'long'
2 | #define int long long
| ^~~~
a.cc:24:44: note: in expansion of macro 'int'
24 | if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
| ^~~
a.cc:24:43: error: expected ')' before 'long'
24 | if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
| ~ ^
| )
a.cc:2:13: error: expected primary-expression before 'long'
2 | #define int long long
| ^~~~
a.cc:28:44: note: in expansion of macro 'int'
28 | if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
| ^~~
a.cc:28:43: error: expected ')' before 'long'
28 | if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
| ~ ^
| )
|
s388741607 | p03747 | C++ | #include <cstdio>
#include <string>
#include <vector>
#include <iostream>
const int maxn = 100010;
using namespace std;
int N, L, T, X[maxn];
int bSearch(int value, int low, int high, vector<int> b, int t)
{
int mid, ret = 0;
while (low <= high)
{
mid = (low + high);
if ( (2 * T - (b[mid] - value)) / L + 1 == t)
{
low = mid + 1;
ret = mid;
}
else
high = mid - 1;
}
return ret;
}
vector <int> solve(vector<int> a, vector<int> b, int flag)
{
int i, j;
int n = a.size();
int m = b.size();
vector<int> ans;
if (flag)
{
for (i = 0; i < n; i ++)
a[i] = L - a[i];
reverse(a.begin(), a.end());
for (i = 0; i < m; i ++)
b[i] = L - b[i];
reverse(b.begin(), b.end());
}
for (int i = 0; i < m; i ++)
b.push_back(b[i] + L);
for (i = j = 0; i < n; i ++)
{
for( ; b[j] < a[i]; j ++);
if (b[j] - a[i] > 2 * T)
{
ans.push_back(0);
continue;
}
int t1, t2;
t1 = (2 * T - (b[j] - a[i])) / L + 1;
if (b[j + m - 1] - a[i] <= 2 * T)
t2 = (2 * T - (b[j + m - 1] - a[i])) / L + 1;
else
t2 = 0;
if (t1 == t2)
ans.push_back((int)((1LL * t1 * m) % N));
else
{
int pivot = bSearch(a[i], j, j + m - 1, b, t1);
ans.push_back((int)((1LL * (pivot - j) * t1 + 1LL * (j + m - 1 - pivot) * t2) % N));
}
}
return ans;
}
int ans[maxn];
int main()
{
int i, j, k, n, m, w;
vector<int> a, b, sa, sb;
cin >> N >> L >> T;
for (k = 0; k < N; k ++)
{
cin >> X[k] >> w;
if (w == 1)
a.push_back(X[k]);
else
b.push_back(X[k]);
}
sa = solve(a, b, 0);
sb = solve(b, a, 1);
n = a.size();
m = b.size();
for (k = i = j = 0; k < N; k ++)
if (i < n && X[k] == a[i])
{
ans[(k + sa[i] + N) % N] = (X[k] + T) % L;
i ++;
}
else if (j < m && X[k] == b[j])
{
ans[(k - sb[j] + N) % N] = ((X[k] - T) % L + L) % L;
j ++;
}
for (k = 0; k < N; k ++)
cout << ans[k] << endl;
return 0;
} | a.cc: In function 'std::vector<int> solve(std::vector<int>, std::vector<int>, int)':
a.cc:36:17: error: 'reverse' was not declared in this scope
36 | reverse(a.begin(), a.end());
| ^~~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.