結果
問題 |
No.551 夏休みの思い出(2)
|
ユーザー |
|
提出日時 | 2025-04-25 22:15:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 794 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 192,996 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-04-25 22:15:52 |
合計ジャッジ時間 | 15,004 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 17 WA * 10 TLE * 1 -- * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; inline int read() { int x=0,f=1; char ch=getchar(); while(ch<48||ch>57) { if(ch==45)f=-1; ch=getchar(); } while(ch>=48&&ch<=57) { x=(x<<1)+(x<<3)+(ch&15); ch=getchar(); } return x*f; } inline void write(int x) { if(x<0)x=-x,putchar(45); if(x>9)write(x/10); putchar(x%10+48); return; } inline int qpow(int x,int y,int mod) { int res=1; while(y) { if(y&1)res=1ll*res*x%mod; x=1ll*x*x%mod; y>>=1; } return res%mod; } int main() { //freopen("equation.in","r",stdin); //freopen("equation.out","w",stdout); int p=read(),r=read(),q=read(); while(q--) { int a=read(),b=read(),c=read(),cnt=0; for(int x=0;x<p;++x) if((a*x%p*x%p+b*x%p+c%p)%p==0) ++cnt,write(x),putchar(' '); puts(cnt?"":"-1"); } return 0; }